Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show contact only to authenticated users #514

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading