1 | import * as RED from './service';
|
2 | import { parameters } from './endPoints';
|
3 | import * as Globals from './globals';
|
4 | import * as UIA from './actions/uiActions';
|
5 | const endpoints = {
|
6 | Login: 'api/accountverification/login',
|
7 | ULogin: 'api/accountverification/ulogin',
|
8 | IsPendingIdentityConfirmation: 'api/accountverification/is/pending/identity/confirmation',
|
9 | IsVerified: 'api/accountverification/is/verified',
|
10 | StartVerificationProcess: 'api/accountverification/start/verification/process',
|
11 | VerifyAccount: 'api/accountverification/verify/account',
|
12 | IsProvider: 'api/accountverification/is/provider',
|
13 | IsLaborer: 'api/accountverification/is/laborer',
|
14 | IsHero: 'api/accountverification/is/hero',
|
15 | IsCustomer: 'api/accountverification/is/customer'
|
16 | }
|
17 | var formatjson = '?format=json';
|
18 | var accountservice = RED.createRedService();
|
19 |
|
20 | export default {
|
21 | startVerificationProcess: async (email, phone) => {
|
22 | phone = phone ? phone.split(' ').join('') : null;
|
23 | email = email || null;
|
24 | UIA.log('email : ' + email);
|
25 | UIA.log('phone : ' + phone);
|
26 | var body = JSON.stringify({ email, phone });
|
27 | return accountservice.post(endpoints.StartVerificationProcess, body).then(res => {
|
28 | return res;
|
29 | });
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | },
|
35 | verifyAccount: async (verificationCode) => {
|
36 | return accountservice.post(endpoints.VerifyAccount, verificationCode).then(res => {
|
37 |
|
38 | UIA.log(res);
|
39 |
|
40 | return res;
|
41 | })
|
42 | },
|
43 | login: async (uniqueMachineSig) => {
|
44 | if (uniqueMachineSig) {
|
45 | return accountservice.post(endpoints.ULogin, uniqueMachineSig);
|
46 | }
|
47 | return accountservice.post(endpoints.Login);
|
48 | },
|
49 | isPendingIdentityConfirmation: async () => {
|
50 | return accountservice.get(endpoints.IsPendingIdentityConfirmation);
|
51 | },
|
52 | isVerified: async () => {
|
53 | return accountservice.get(endpoints.IsVerified)
|
54 | }
|
55 | } |
\ | No newline at end of file |