Skip to content

Commit

Permalink
fix: restricted roles
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Oct 6, 2023
1 parent 1bcb404 commit c56ab0f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions dashboard/src/components/DataLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,11 @@ export function useDataLoader(options = { refreshOnMount: false }) {
stats.relsPersonPlace +
stats.territoryObservations +
stats.comments +
stats.consultations +
stats.treatments +
stats.medicalFiles;
stats.consultations;

if (['admin', 'normal'].includes(latestUser.role)) {
itemsCount += stats.treatments + stats.medicalFiles;
}

setProgress(0);
setTotal(itemsCount);
Expand Down Expand Up @@ -358,7 +360,7 @@ export function useDataLoader(options = { refreshOnMount: false }) {
const consultationsSuccess = await loadConsultations(0);
if (!consultationsSuccess) return false;
}
if (stats.treatments > 0) {
if (['admin', 'normal'].includes(latestUser.role) && stats.treatments > 0) {
let newItems = [];
setLoadingText('Chargement des traitements');
async function loadTreatments(page = 0) {
Expand All @@ -373,7 +375,7 @@ export function useDataLoader(options = { refreshOnMount: false }) {
const treatmentsSuccess = await loadTreatments(0);
if (!treatmentsSuccess) return false;
}
if (stats.medicalFiles > 0) {
if (['admin', 'normal'].includes(latestUser.role) && stats.medicalFiles > 0) {
let newItems = [];
setLoadingText('Chargement des fichiers médicaux');
async function loadMedicalFiles(page = 0) {
Expand Down

0 comments on commit c56ab0f

Please sign in to comment.