From 1a9f3c8f8bdd2e70126b835e062b9354afc9cf31 Mon Sep 17 00:00:00 2001 From: Julien Pavon Date: Fri, 17 Nov 2023 10:12:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Ajout=20d'une=20route=20"/signou?= =?UTF-8?q?t"=20pour=20utiliser=20le=20FF=20pour=20l'app=20NextJS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/index.ts | 1 + src/controllers/signout.ts | 10 ++++++++++ src/routes.ts | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 src/controllers/signout.ts diff --git a/src/controllers/index.ts b/src/controllers/index.ts index 65d04fdb0a..9634ab5035 100644 --- a/src/controllers/index.ts +++ b/src/controllers/index.ts @@ -12,6 +12,7 @@ export * from './tableauxDeBord'; export * from './userAccount'; export * from './getDéclarationAccessibilitéPage'; export * from './getSuccèsPage'; +export * from './signout'; export * from './upload'; export * from './v1Router'; export * from './raccordement'; diff --git a/src/controllers/signout.ts b/src/controllers/signout.ts new file mode 100644 index 0000000000..c3d51d2ce6 --- /dev/null +++ b/src/controllers/signout.ts @@ -0,0 +1,10 @@ +import asyncHandler from './helpers/asyncHandler'; +import routes from '../routes'; +import { v1Router } from './v1Router'; + +v1Router.get( + routes.LOGOUT_ACTION, + asyncHandler(async (request, response) => { + response.redirect(process.env.NEXT_APP_ACTIVATED === 'true' ? '/auth/signOut' : '/logout'); + }), +); diff --git a/src/routes.ts b/src/routes.ts index e39e05ce70..3a4994bb2d 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -34,7 +34,7 @@ class routes { static ABONNEMENT_LETTRE_INFORMATION = '/abonnement-lettre-information.html'; static POST_SINSCRIRE_LETTRE_INFORMATION = '/s-inscrire-a-la-lettre-d-information'; static DECLARATION_ACCESSIBILITE = '/accessibilite.html'; - static LOGOUT_ACTION = process.env.NEXT_APP_ACTIVATED === 'true' ? '/auth/signOut' : '/logout'; + static LOGOUT_ACTION = '/signout'; static SIGNUP = '/signup.html'; static POST_SIGNUP = '/signup';