mirror of https://github.com/hykilpikonna/AquaDX
[+] Card summary sdk
parent
06993b9d66
commit
cac2f49b06
|
@ -24,3 +24,18 @@ export interface UserMe {
|
||||||
cards: Card[]
|
cards: Card[]
|
||||||
computedName: string
|
computedName: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CardSummaryGame {
|
||||||
|
name: string
|
||||||
|
rating: number
|
||||||
|
lastLogin: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CardSummary {
|
||||||
|
maimai: CardSummaryGame | null
|
||||||
|
maimai2: CardSummaryGame | null
|
||||||
|
chusan: CardSummaryGame | null
|
||||||
|
chunithm: CardSummaryGame | null
|
||||||
|
ongeki: CardSummaryGame | null
|
||||||
|
diva: CardSummaryGame | null
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { AQUA_HOST } from "./config";
|
import { AQUA_HOST } from "./config";
|
||||||
import type { UserMe } from "./generalTypes";
|
import type { Card, CardSummary, UserMe } from "./generalTypes";
|
||||||
|
|
||||||
interface RequestInitWithParams extends RequestInit {
|
interface RequestInitWithParams extends RequestInit {
|
||||||
params?: { [index: string]: string }
|
params?: { [index: string]: string }
|
||||||
|
@ -72,18 +72,19 @@ async function login(user: { email: string, password: string, turnstile: string
|
||||||
localStorage.setItem('token', data.token)
|
localStorage.setItem('token', data.token)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function confirmEmail(token: string) {
|
|
||||||
return await post('/api/v2/user/confirm-email', { token })
|
|
||||||
}
|
|
||||||
|
|
||||||
async function me(): Promise<UserMe> {
|
|
||||||
return await post('/api/v2/user/me', {})
|
|
||||||
}
|
|
||||||
|
|
||||||
export const USER = {
|
export const USER = {
|
||||||
register,
|
register,
|
||||||
login,
|
login,
|
||||||
confirmEmail,
|
confirmEmail: (token: string) =>
|
||||||
me,
|
post('/api/v2/user/confirm-email', { token }),
|
||||||
|
me: (): Promise<UserMe> =>
|
||||||
|
post('/api/v2/user/me', {}),
|
||||||
isLoggedIn: () => !!localStorage.getItem('token')
|
isLoggedIn: () => !!localStorage.getItem('token')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const CARD = {
|
||||||
|
summary: (cardId: string): Promise<{card: Card, summary: CardSummary}> =>
|
||||||
|
post('/api/v2/card/summary', { cardId }),
|
||||||
|
bind: (props: { cardId: string, migrate: string }) =>
|
||||||
|
post('/api/v2/card/bind', props),
|
||||||
|
}
|
Loading…
Reference in New Issue