Skip to content

Commit

Permalink
fix: add missing roles
Browse files Browse the repository at this point in the history
  • Loading branch information
iNeoO committed Nov 13, 2024
1 parent ada8f1a commit 437da31
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
12 changes: 11 additions & 1 deletion packages/frontend-bo/src/components/demandes-sejour/Actions.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div v-if="isActionsVisible">
<DsfrButton
label="Demander des compléments à l'organisateur"
tertiary
Expand Down Expand Up @@ -89,6 +89,7 @@
import { useIsDownloading } from "~/composables/useIsDownloading";
const demandeSejourStore = useDemandeSejourStore();
const userStore = useUserStore();
const currentDemande = computed(() => demandeSejourStore.currentDemande);
const status = demandesSejours.statuts;
Expand Down Expand Up @@ -158,4 +159,13 @@ const onValidEnregistrement2Mois = async () => {
demandeSejourStore.getCurrentDemande(route.params.declarationId);
demandeSejourStore.getHistory(route.params.declarationId);
};
const isActionsVisible = computed(
() =>
!apiStatus.isDownloading &&
userStore.user?.roles?.includes("DemandeSejour_Ecriture") &&
demandeSejourStore.currentDemande.estInstructeurPrincipal &&
(demandeSejourStore.currentDemande.statut === status.EN_COURS ||
demandeSejourStore.currentDemande?.statut === status.EN_COURS_8J),
);
</script>
1 change: 1 addition & 0 deletions packages/frontend-bo/src/pages/sejours/[declarationId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { DsfrTabsV2 } from "@vao/shared";
definePageMeta({
layout: "default",
middleware: ["is-connected"],
roles: ["DemandeSejour_Lecture", "DemandeSejour_Ecriture"],
});
const route = useRoute();
Expand Down
13 changes: 8 additions & 5 deletions packages/frontend-bo/src/stores/demande-sejour.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,14 @@ export const useDemandeSejourStore = defineStore("demandeSejour", {
},

async prendreEnCharge(declarationId) {
const response = await $fetchBackend(`/sejour/admin/${declarationId}/prise-en-charge`, {
method: "POST",
credentials: "include",
});
return response
const response = await $fetchBackend(
`/sejour/admin/${declarationId}/prise-en-charge`,
{
method: "POST",
credentials: "include",
},
);
return response;
},

async postMessage(declarationId, body) {
Expand Down

0 comments on commit 437da31

Please sign in to comment.