Skip to content

Commit

Permalink
Show contact only to authenticated users
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Jul 11, 2024
1 parent b971331 commit 73eb60a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 56 deletions.
39 changes: 2 additions & 37 deletions frontend/src/components/ContactExpert.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<script lang="ts" setup>
import { useRouter } from "vue-router";
const router = useRouter();
const showModal = ref(false);
function onClose() {
showModal.value = false;
}
</script>
<script lang="ts" setup></script>

<template>
<div class="text-center">
Expand All @@ -16,35 +7,9 @@ function onClose() {
href="#"
icon="ri-alert-line"
label="Contacter un expert"
@click="showModal = true"
@click="$router.push({ name: 'ExpertSituationGN' })"
/>
</div>
<Teleport to="body">
<DsfrModal :opened="showModal" @close="onClose()">
<div class="modal">
<div class="modal-content">
<div class="fr-modal__title fr-mb-2w">
<VIcon name="ri-arrow-right-line" scale="1.5" />
Contacter un expert
</div>
<p>Sélectionnez ci-dessous votre corps de métier.</p>
<div>
<DsfrButton
class="w-100 m-1"
label="Police Nationale"
:disabled="true"
@click="router.push({ name: 'ExpertSituationPN' })"
/>
<DsfrButton
class="w-100 m-1"
label="Gendarmerie Nationale"
@click="router.push({ name: 'ExpertSituationGN' })"
/>
</div>
</div>
</div>
</DsfrModal>
</Teleport>
</template>
<style scoped>
:deep(.fr-btn) span {
Expand Down
11 changes: 0 additions & 11 deletions frontend/src/components/authentication/User.vue

This file was deleted.

16 changes: 8 additions & 8 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const IdentificationBlankGun = () =>
const ExpertSituation = () =>
import("@/views/GuideContactExpert/ExpertSituation.vue");

const User = () => import("@/components/authentication/User.vue");

const routes: RouteRecordRaw[] = [
{
path: "/",
Expand Down Expand Up @@ -207,6 +205,12 @@ const routes: RouteRecordRaw[] = [
path: "/guide-contact-gn",
name: "ExpertSituationGN",
component: ExpertSituation,
beforeEnter: (to, from) => {
mgr.getUser().then((user) => {
console.log(user);
if (user === null) mgr.signinRedirect();
});
},
},
{
path: "/auth",
Expand All @@ -223,14 +227,10 @@ const routes: RouteRecordRaw[] = [
name: "AuthCallback",
beforeEnter: (to, from) => {
mgr.signinCallback();
return { name: "User" };
mgr.getUser().then((user) => console.log(user));
return { name: "ExpertSituationGN" };
},
},
{
path: "user",
name: "User",
component: User,
},
],
},
];
Expand Down

0 comments on commit 73eb60a

Please sign in to comment.