2019-12-08 00:32:00 +05:30
|
|
|
import request, { Resp } from 'app/services/request';
|
2017-08-02 01:30:02 +05:30
|
|
|
|
2021-07-14 02:10:31 +05:30
|
|
|
export function getSecret(id: number): Promise<
|
2020-05-24 04:38:24 +05:30
|
|
|
Resp<{
|
|
|
|
qr: string;
|
|
|
|
secret: string;
|
|
|
|
uri: string;
|
|
|
|
}>
|
2019-11-27 14:33:32 +05:30
|
|
|
> {
|
2020-05-24 04:38:24 +05:30
|
|
|
return request.get(`/api/v1/accounts/${id}/two-factor-auth`);
|
2019-01-28 00:42:58 +05:30
|
|
|
}
|
2017-08-20 21:15:21 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
export function enable(id: number, totp: string, password?: string): Promise<Resp<any>> {
|
|
|
|
return request.post(`/api/v1/accounts/${id}/two-factor-auth`, {
|
|
|
|
totp,
|
|
|
|
password,
|
|
|
|
});
|
2019-01-28 00:42:58 +05:30
|
|
|
}
|
2017-08-20 21:15:21 +05:30
|
|
|
|
2020-05-24 04:38:24 +05:30
|
|
|
export function disable(id: number, totp: string, password?: string): Promise<Resp<any>> {
|
|
|
|
return request.delete(`/api/v1/accounts/${id}/two-factor-auth`, {
|
|
|
|
totp,
|
|
|
|
password,
|
|
|
|
});
|
2019-01-28 00:42:58 +05:30
|
|
|
}
|