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';