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

24 lines
687 B
JavaScript
Raw Normal View History

// @flow
import request from 'services/request';
import type { Resp } from 'services/request';
export default {
getSecret(): Promise<Resp<{qr: string, secret: string, uri: string}>> {
return request.get('/api/two-factor-auth');
},
enable(data: {totp: string, password?: string}): Promise<Resp<*>> {
return request.post('/api/two-factor-auth', {
2017-09-09 19:52:19 +05:30
totp: data.totp,
password: data.password || ''
2017-09-09 19:52:19 +05:30
});
},
2017-09-09 19:52:19 +05:30
disable(data: {totp: string, password?: string}): Promise<Resp<*>> {
return request.delete('/api/two-factor-auth', {
totp: data.totp,
password: data.password || ''
});
}
};