25 lines
541 B
TypeScript
25 lines
541 B
TypeScript
import { authedRequest, type AuthSession } from './authed-request'
|
|
|
|
export interface UserInfo {
|
|
userID?: string
|
|
username?: string
|
|
phone?: string
|
|
email?: string
|
|
nickname?: string
|
|
[key: string]: unknown
|
|
}
|
|
|
|
const USER_INFO_PATH = import.meta.env.VITE_USER_INFO_PATH ?? '/api/v1/user/info'
|
|
|
|
export async function getUserInfo(
|
|
auth: AuthSession,
|
|
onAuthUpdated?: (next: AuthSession) => void,
|
|
): Promise<UserInfo> {
|
|
return authedRequest<UserInfo>({
|
|
method: 'GET',
|
|
path: USER_INFO_PATH,
|
|
auth,
|
|
onAuthUpdated,
|
|
})
|
|
}
|