mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-30 03:36:37 +08:00
18 lines
454 B
TypeScript
18 lines
454 B
TypeScript
import { api } from './client'
|
|
import type { User } from '../types'
|
|
|
|
export const profileAPI = {
|
|
update: (patch: {
|
|
username?: string
|
|
nickname?: string
|
|
email?: string
|
|
avatar_url?: string
|
|
hide_adult?: boolean
|
|
password?: string
|
|
}) =>
|
|
api.patch<User>('/me', patch).then((r) => r.data),
|
|
|
|
adminUpdateRole: (id: string, role: 'admin' | 'user') =>
|
|
api.patch<User>(`/admin/users/${id}/role`, { role }).then((r) => r.data),
|
|
}
|