all repos — caroster @ 406456e1af7399c4bf12340f443334a004070db9

[Octree] Group carpool to your event https://caroster.io

🐛 Fix login redirections
Tim Izzo tim@octree.ch
Thu, 29 Aug 2024 17:46:47 +0200
commit

406456e1af7399c4bf12340f443334a004070db9

parent

db2009aa853a692e1b35a7a5632c42f3489f121c

3 files changed, 23 insertions(+), 10 deletions(-)

jump to
M .dockerignore.dockerignore

@@ -9,4 +9,5 @@ backend/build

frontend/.next .gitlab-ci.yml banner.jpg -*.md+*.md +e2e
M backend/src/graphql/passenger/createPassenger.tsbackend/src/graphql/passenger/createPassenger.ts

@@ -56,15 +56,19 @@ .locale(createdPassenger.user.lang || "en")

.format("dddd LL") : ""; const datetime = `${date} ${travel.departureTime || ""}`; - strapi.entityService.create("api::notification.notification", { - data: { - type: "ContactTripCreator", - event: createdPassenger.event.id, - user: createdPassenger.user.id, - // @ts-expect-error - payload: { travel, driver, datetime }, - }, - }); + try { + await strapi.entityService.create("api::notification.notification", { + data: { + type: "ContactTripCreator", + event: createdPassenger.event.id, + user: createdPassenger.user.id, + // @ts-expect-error + payload: { travel, driver, datetime }, + }, + }); + } catch (error) { + console.error(error); + } } const { toEntityResponse } = strapi
M frontend/pages/auth/login.tsxfrontend/pages/auth/login.tsx

@@ -9,6 +9,7 @@ import SignInForm from '../../containers/SignInForm';

import LanguagesIcon from '../../containers/Languages/Icon'; import pageUtils from '../../lib/pageUtils'; import Container from '@mui/material/Container'; +import Cookies from 'cookies'; interface PageProps { error?: string;

@@ -53,6 +54,13 @@ else

return pageUtils.getServerSideProps(async ctx => { const error = ctx.query?.error || null; const emailConfirmation = ctx.query?.confirmed === 'true'; + const redirectPath = ctx.query?.redirectPath; + + if (redirectPath) { + const cookies = new Cookies(ctx.req, ctx.res); + cookies.set('redirectPath', redirectPath); + } + return {props: {error, emailConfirmation}}; })(context); };