- removed unwanted call for companies for admin user;

This commit is contained in:
Vitalii Kiiko
2024-10-01 15:05:48 +02:00
parent 340b805643
commit fefba1acaf
2 changed files with 13 additions and 7 deletions

View File

@@ -7,7 +7,7 @@ import './assets/scss/theme.scss';
import AuthenticationService from './service/authentication-service';
// store
import { useStore, storeSet } from './store';
import { useStore, storeSet, storeGet } from './store';
import CompanyService from './service/company-service';
const i18n = createI18n({}, 'gepafin');
@@ -16,17 +16,15 @@ function App() {
const role = useStore().main.getRole();
const callback = (data) => {
storeSet.main.unsetAsyncRequest();
if (data.status === 'SUCCESS') {
storeSet.main.userData(data.data);
storeSet.main.setAsyncRequest();
CompanyService.getCompanyForUser(data.data.id, companyCallback, errCompanyCallback)
} else {
storeSet.main.doLogout();
}
storeSet.main.unsetAsyncRequest();
}
const errCallback = (data) => {
const errCallback = () => {
storeSet.main.doLogout();
storeSet.main.unsetAsyncRequest();
}
@@ -43,6 +41,14 @@ function App() {
storeSet.main.unsetAsyncRequest();
}
useEffect(() => {
if (role === 'ROLE_BENEFICIARY') {
storeSet.main.setAsyncRequest();
const userData = storeGet.main.userData();
CompanyService.getCompanyForUser(userData.id, companyCallback, errCompanyCallback)
}
}, [role])
useEffect(() => {
storeSet.main.setAsyncRequest();
AuthenticationService.me(callback, errCallback);

View File

@@ -734,7 +734,7 @@ export const elementItems = [
],
validators: {}
},
/*{
{
id: 20,
sortOrder: 20,
name: 'table',
@@ -747,5 +747,5 @@ export const elementItems = [
}
],
validators: {}
}*/
}
]