focalxaiinspection
Version:
Focalx AI Inspection
36 lines (32 loc) • 1.06 kB
JavaScript
//import GetBaseURL from './base';
const UserProfile = async (token) => {
// console.log("User Profile Page:" + token);
//const baseUrl = GetBaseURL();
const car_info = JSON.parse(sessionStorage.getItem('carInformation'));
const baseUrl = car_info.baseUrl;
const url = `https://www.${baseUrl}/api/v1/customer/user-profile/`;
// const url = 'https://www.tenant.dev.focalx.gq/api/v1/customer/user-profile/';
return fetch(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
// Store the value of data.client.schema_name in sessionStorage
sessionStorage.setItem('schema_name', data.client.schema_name);
// console.log(data.client.schema_name);
return data;
})
.catch(error => {
console.error('Error:', error);
});
}
export default UserProfile;