Skip to content

Commit

Permalink
Ajoute un retour à l'utilisateur que l'action est en cours
Browse files Browse the repository at this point in the history
  • Loading branch information
Charline-L committed Mar 5, 2025
1 parent 86a6295 commit c733efb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions 2024-frontend/src/components/CanteenCreationResult.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup>
import { ref } from "vue"
import { useRouter } from "vue-router"
import { useRootStore } from "@/stores/root"
import canteensService from "@/services/canteens"
Expand All @@ -12,18 +13,24 @@ const store = useRootStore()
const router = useRouter()
/* Claim a canteen */
const loading = ref(false)
const claimCanteen = () => {
loading.value = true
canteensService
.claimCanteen(props.id)
.then((response) => {
loading.value = false
if (response.id) {
router.push({
name: "DashboardManager",
params: { canteenUrlComponent: response.id },
})
}
})
.catch((e) => store.notifyServerError(e))
.catch((e) => {
loading.value = false
store.notifyServerError(e)
})
}
</script>

Expand Down Expand Up @@ -69,7 +76,7 @@ const claimCanteen = () => {
La cantine avec le numéro SIRET {{ siret }} est déjà référencée sur notre site, mais n'a pas de gestionnaire
enregistré.
</p>
<DsfrButton tertiary label="Rejoindre la cantine" @click="claimCanteen()" />
<DsfrButton tertiary label="Rejoindre la cantine" @click="claimCanteen()" :disabled="loading" />
</div>
</div>
</div>
Expand Down

0 comments on commit c733efb

Please # to comment.