mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-25 14:39:53 +05:30
26 lines
663 B
TypeScript
26 lines
663 B
TypeScript
import request, { Resp } from 'app/services/request';
|
|
|
|
export function getSecret(id: number): Promise<
|
|
Resp<{
|
|
qr: string;
|
|
secret: string;
|
|
uri: string;
|
|
}>
|
|
> {
|
|
return request.get(`/api/v1/accounts/${id}/two-factor-auth`);
|
|
}
|
|
|
|
export function enable(id: number, totp: string, password?: string): Promise<Resp<any>> {
|
|
return request.post(`/api/v1/accounts/${id}/two-factor-auth`, {
|
|
totp,
|
|
password,
|
|
});
|
|
}
|
|
|
|
export function disable(id: number, totp: string, password?: string): Promise<Resp<any>> {
|
|
return request.delete(`/api/v1/accounts/${id}/two-factor-auth`, {
|
|
totp,
|
|
password,
|
|
});
|
|
}
|