Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d43300724 | |||
| e05d465c2f | |||
| 75a7496164 |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 84 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 713 B After Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 950 B |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -21,7 +21,7 @@ const HeaderUserMenu: FC = () => {
|
||||
<div className='d-flex flex-column'>
|
||||
<div className='fw-bolder d-flex align-items-center fs-5'>
|
||||
{currentUser?.first_name} {currentUser?.first_name}
|
||||
<span className='badge badge-light-success fw-bolder fs-8 px-2 py-1 ms-2'>Pro</span>
|
||||
{/*<span className='badge badge-light-success fw-bolder fs-8 px-2 py-1 ms-2'>Pro</span>*/}
|
||||
</div>
|
||||
<a href='#' className='fw-bold text-muted text-hover-primary fs-7'>
|
||||
{currentUser?.email}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
import axios from "axios";
|
||||
|
||||
export function postAuxEnd(uri:string, reqData:any):Promise<any> {
|
||||
// const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
|
||||
const formData = new FormData();
|
||||
for (let value in reqData) {
|
||||
formData.append(value, reqData[value]);
|
||||
}
|
||||
return axios.post(uri, reqData)
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
// if (response.data.internal_return == "-9999") {
|
||||
// localStorage.clear();
|
||||
// window.location.href = `/login?sessionExpired=true`;
|
||||
// }
|
||||
return response;
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.response) {
|
||||
//response status is an error code
|
||||
console.log(
|
||||
"ERROR-------------------------------------------------------"
|
||||
);
|
||||
console.log(error.response.status);
|
||||
console.log(
|
||||
"ERROR-------------------------------------------------------"
|
||||
);
|
||||
} else if (error.request) {
|
||||
//response not received though the request was sent
|
||||
console.log(
|
||||
"ERROR2-------------------------------------------------------"
|
||||
);
|
||||
console.log(error?.request);
|
||||
console.log(
|
||||
"ERROR2-------------------------------------------------------"
|
||||
);
|
||||
} else {
|
||||
//an error occurred when setting up the request
|
||||
console.log(
|
||||
"ERROR3-------------------------------------------------------"
|
||||
);
|
||||
console.log(error);
|
||||
console.log(
|
||||
"ERROR3-------------------------------------------------------"
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,29 @@
|
||||
import axios from "axios";
|
||||
import { AuthModel, UserModel } from "./_models";
|
||||
|
||||
import { postAuxEnd } from "./AxiosCallHelper";
|
||||
|
||||
const API_URL = import.meta.env.VITE_APP_API_URL;
|
||||
|
||||
export const GET_USER_BY_ACCESSTOKEN_URL = `${API_URL}/verify_token`;
|
||||
export const LOGIN_URL = `${API_URL}/login`;
|
||||
// export const LOGIN_URL = 'https://digifi-apidev.chiefsoft.net/digibko/v1/identity/token'
|
||||
export const REGISTER_URL = `${API_URL}/register`;
|
||||
export const REQUEST_PASSWORD_URL = `${API_URL}/forgot_password`;
|
||||
|
||||
// Server should return AuthModel
|
||||
//Function to login user in // Server should return AuthModel
|
||||
export function login(email: string, password: string) {
|
||||
return axios.post<AuthModel>(LOGIN_URL, {
|
||||
email,
|
||||
password,
|
||||
});
|
||||
// return axios.post<AuthModel>(LOGIN_URL, {
|
||||
// email,
|
||||
// password,
|
||||
// });
|
||||
|
||||
// let formData = new FormData()
|
||||
// formData.append('username', email)
|
||||
// formData.append('pass', password)
|
||||
// return axios.post<AuthModel>(LOGIN_URL, formData);
|
||||
|
||||
return postAuxEnd(LOGIN_URL, {email, password})
|
||||
}
|
||||
|
||||
// Server should return AuthModel
|
||||
|
||||