25 lines
715 B
TypeScript
25 lines
715 B
TypeScript
import { del, get, post } from '@/lib/http/client'
|
|
import type {
|
|
SocialAccountInfo,
|
|
SocialAccountUnbindRequest,
|
|
SocialBindingStartRequest,
|
|
SocialBindingStartResponse,
|
|
} from '@/types'
|
|
|
|
export function listSocialAccounts(): Promise<SocialAccountInfo[]> {
|
|
return get<SocialAccountInfo[]>('/users/me/social-accounts')
|
|
}
|
|
|
|
export function startSocialBinding(
|
|
payload: SocialBindingStartRequest,
|
|
): Promise<SocialBindingStartResponse> {
|
|
return post<SocialBindingStartResponse>('/users/me/bind-social', payload)
|
|
}
|
|
|
|
export function unbindSocialAccount(
|
|
provider: string,
|
|
payload?: SocialAccountUnbindRequest,
|
|
): Promise<void> {
|
|
return del<void>(`/users/me/bind-social/${provider}`, { body: payload })
|
|
}
|