mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-29 16:30:54 +05:30
28 lines
670 B
TypeScript
28 lines
670 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,
|
|
});
|
|
}
|