first commit
This commit is contained in:
24
src/api/user.ts
Normal file
24
src/api/user.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user