28 lines
670 B
TypeScript
Raw Normal View History

import request, { Resp } from 'app/services/request';
export function getSecret(
2020-05-24 02:08:24 +03:00
id: number,
): Promise<
2020-05-24 02:08:24 +03:00
Resp<{
qr: string;
secret: string;
uri: string;
}>
> {
2020-05-24 02:08:24 +03:00
return request.get(`/api/v1/accounts/${id}/two-factor-auth`);
}
2020-05-24 02:08:24 +03:00
export function enable(id: number, totp: string, password?: string): Promise<Resp<any>> {
return request.post(`/api/v1/accounts/${id}/two-factor-auth`, {
totp,
password,
});
}
2020-05-24 02:08:24 +03:00
export function disable(id: number, totp: string, password?: string): Promise<Resp<any>> {
return request.delete(`/api/v1/accounts/${id}/two-factor-auth`, {
totp,
password,
});
}