2019-12-08 00:32:00 +05:30
|
|
|
import request, { Resp } from 'app/services/request';
|
2017-08-02 01:30:02 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
export function getSecret(
|
|
|
|
id: number,
|
|
|
|
): Promise<
|
|
|
|
Resp<{
|
2019-12-07 16:58:52 +05:30
|
|
|
qr: string;
|
|
|
|
secret: string;
|
|
|
|
uri: string;
|
|
|
|
}>
|
2019-11-27 14:33:32 +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
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
export function enable(
|
|
|
|
id: number,
|
|
|
|
totp: string,
|
|
|
|
password?: string,
|
2019-12-07 16:58:52 +05:30
|
|
|
): Promise<Resp<any>> {
|
2019-11-27 14:33:32 +05:30
|
|
|
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
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
export function disable(
|
|
|
|
id: number,
|
|
|
|
totp: string,
|
|
|
|
password?: string,
|
2019-12-07 16:58:52 +05:30
|
|
|
): Promise<Resp<any>> {
|
2019-11-27 14:33:32 +05:30
|
|
|
return request.delete(`/api/v1/accounts/${id}/two-factor-auth`, {
|
|
|
|
totp,
|
|
|
|
password,
|
|
|
|
});
|
2019-01-28 00:42:58 +05:30
|
|
|
}
|