cpLoginAction.js
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import axios from "axios";
import { CLEAR_ERRORS } from "../constants/cpLoginConstants";
export const finishChannelPartnerOtpLogin = async ({ mobileNumber, mahareraNumber, oneTimePassword }) => {
// 1. invoke the api to start the login with otp process.
const config = {
headers: {
"Content-Type": "application/json"
}
};
return await axios.post(
`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/users-permissions/users/channel-partner/finish-otp-login`,
{
mobileNumber,
mahareraNumber,
oneTimePassword
},
config
);
};
export const startChannelPartnerOtpLogin = async ({ mobileNumber, mahareraNumber }) => {
// 1. invoke the api to start the login with otp process.
const config = {
headers: {
"Content-Type": "application/json"
}
};
const startOtpLoginResponse = await axios.post(
`${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/users-permissions/users/channel-partner/start-otp-login`,
{
mobileNumber,
mahareraNumber
},
config
);
return startOtpLoginResponse;
};
// Clear errors
export const clearErrors = () => async dispatch => {
dispatch({
type: CLEAR_ERRORS
});
};