mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-12 06:07:27 +08:00
[+] /user/me sdk
This commit is contained in:
@@ -3,3 +3,24 @@ export interface TrendEntry {
|
|||||||
rating: number
|
rating: number
|
||||||
plays: number
|
plays: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface Card {
|
||||||
|
luid: string
|
||||||
|
registerTime: string
|
||||||
|
accessTime: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UserMe {
|
||||||
|
username: string
|
||||||
|
email: string
|
||||||
|
displayName: string
|
||||||
|
country: string
|
||||||
|
lastLogin: number
|
||||||
|
regTime: number
|
||||||
|
profileLocation: string
|
||||||
|
profileBio: string
|
||||||
|
emailConfirmed: boolean
|
||||||
|
ghostCard: Card
|
||||||
|
cards: Card[]
|
||||||
|
computedName: string
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { AQUA_HOST } from "./config";
|
import { AQUA_HOST } from "./config";
|
||||||
|
import type { UserMe } from "./generalTypes";
|
||||||
|
|
||||||
interface RequestInitWithParams extends RequestInit {
|
interface RequestInitWithParams extends RequestInit {
|
||||||
params?: { [index: string]: string }
|
params?: { [index: string]: string }
|
||||||
@@ -75,9 +76,14 @@ async function confirmEmail(token: string) {
|
|||||||
return await post('/api/v2/user/confirm-email', { token })
|
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,
|
||||||
|
me,
|
||||||
isLoggedIn: () => !!localStorage.getItem('token')
|
isLoggedIn: () => !!localStorage.getItem('token')
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user