initial commit
This commit is contained in:
@@ -45,6 +45,29 @@ export function postAuxEnd(uri:string, reqData:any):Promise<any> {
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
export function getAuxEnd(uri: string, reqData?: any): Promise<any> {
|
||||
const endPoint = import.meta.env.VITE_APP_USER_ENDPOINT + uri;
|
||||
const formData = new FormData();
|
||||
for (let value in reqData) {
|
||||
formData.append(value, reqData[value]);
|
||||
}
|
||||
return axios
|
||||
.get(endPoint, reqData)
|
||||
.then((response: {}) => {
|
||||
// if (response.data.internal_return == "-9999") {
|
||||
// localStorage.clear();
|
||||
// window.location.href = `/login?sessionExpired=true`;
|
||||
// }
|
||||
return response;
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.log(
|
||||
"ERROR3-------------------------------------------------------", error
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import axios from "axios";
|
||||
import { AuthModel, UserModel } from "./_models";
|
||||
|
||||
import { postAuxEnd } from "./AxiosCallHelper";
|
||||
import { postAuxEnd, getAuxEnd } from "./AxiosCallHelper";
|
||||
|
||||
const API_URL = import.meta.env.VITE_APP_API_URL;
|
||||
|
||||
@@ -10,6 +10,7 @@ const API_URL = import.meta.env.VITE_APP_API_URL;
|
||||
|
||||
export const GET_USER_BY_ACCESSTOKEN_URL = '/identity/verify_token'
|
||||
export const LOGIN_URL = '/identity/token'
|
||||
export const USER_DASH_DETAILS = `/dash`;
|
||||
export const REGISTER_URL = `${API_URL}/register`;
|
||||
export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`;
|
||||
|
||||
@@ -55,3 +56,7 @@ export function requestPassword(email: string) {
|
||||
export function getUserByToken(token: string) {
|
||||
return postAuxEnd(GET_USER_BY_ACCESSTOKEN_URL, {token})
|
||||
}
|
||||
|
||||
export function getUserDashDetails() {
|
||||
return getAuxEnd(USER_DASH_DETAILS)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user