You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.7 KiB
61 lines
1.7 KiB
import proxy from "../proxy"; |
|
|
|
const user = { |
|
getStatus: () => async (dispatch) => { |
|
await proxy.getStatus({ dispatch }); |
|
}, |
|
otp: (data) => async (dispatch) => { |
|
await proxy.post("public/sendOTP", data, { dispatch }); |
|
}, |
|
|
|
otp_login: |
|
(data = {}) => |
|
async (dispatch) => { |
|
await proxy.login("user/otp/login", data, { dispatch }); |
|
}, |
|
|
|
login: (data) => async (dispatch) => |
|
await proxy.login("user/login", data, { dispatch }), |
|
|
|
// register: (data : undefined) => async (dispatch : Dispatch) => |
|
// await proxy.login("user/register", data, { dispatch }), |
|
|
|
// switchRole: (data : String) => async (dispatch : Dispatch) => |
|
// await proxy.login("user/switchRole", data, { dispatch }), |
|
|
|
logout: (data) => async (dispatch) => |
|
await proxy.logout("user/logout", data, { dispatch }), |
|
|
|
getUserRole: (data) => async (dispatch) => |
|
await proxy.get("user/getUserRole", data, { dispatch }), |
|
|
|
getProfile: |
|
(data = {}) => |
|
async (dispatch) => |
|
await proxy.get("user/getProfile", data, { dispatch }), |
|
setProfile: |
|
(data = {}, data2 = {}) => |
|
async (dispatch) => { |
|
await proxy.put("user/setProfile", data, { dispatch }); |
|
await proxy.get("user/getProfile", data2, { dispatch }); |
|
}, |
|
setProfileFields: |
|
(data = {}) => |
|
async (dispatch) => { |
|
await dispatch({ type: "user/setProfileFields", data }); |
|
}, |
|
add: |
|
(data = {}, data2 = {}) => |
|
async (dispatch) => { |
|
await proxy.post("user/add", data); |
|
await proxy.get("user/list", data2, { dispatch }); |
|
}, |
|
del: |
|
(data = {}, data2 = {}) => |
|
async (dispatch) => { |
|
await proxy.delete("user/delete", data); |
|
await proxy.get("user/list", data2, { dispatch }); |
|
}, |
|
}; |
|
|
|
export default user;
|
|
|