Compare commits

...

3 Commits

Author SHA1 Message Date
victorAnumudu 7d43300724 added axios verb call function 2024-05-01 14:42:43 +01:00
CHIEFSOFT\ameye e05d465c2f icons update 2024-04-29 16:15:32 -04:00
ameye 75a7496164 Merge branch 'page-tables' of DigiFi/digifi-bko into master 2024-04-25 17:02:41 +00:00
10 changed files with 66 additions and 6 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 713 B

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 950 B

Binary file not shown.

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-------------------------------------------------------"
);
}
});
}
+15 -5
View File
@@ -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