accounts-frontend/src/services/api/mfa.ts

36 lines
640 B
TypeScript
Raw Normal View History

2019-12-07 16:58:52 +05:30
import request, { Resp } from 'services/request';
export function getSecret(
id: number,
): Promise<
Resp<{
2019-12-07 16:58:52 +05:30
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,
2019-12-07 16:58:52 +05:30
): Promise<Resp<any>> {
return request.post(`/api/v1/accounts/${id}/two-factor-auth`, {
totp,
password,
});
}
export function disable(
id: number,
totp: string,
password?: string,
2019-12-07 16:58:52 +05:30
): Promise<Resp<any>> {
return request.delete(`/api/v1/accounts/${id}/two-factor-auth`, {
totp,
password,
});
}