From eeceddc545e2ef0a75619343ffbb70a64636c88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matilda=20Landstr=C3=B6m?= Date: Wed, 22 May 2024 10:37:20 +0200 Subject: [PATCH] chore: remove invalidateSession --- app/[lang]/(live)/(protected)/logout/route.ts | 2 -- lib/api/endpoints.ts | 1 - server/routers/user/query.ts | 30 ------------------- 3 files changed, 33 deletions(-) diff --git a/app/[lang]/(live)/(protected)/logout/route.ts b/app/[lang]/(live)/(protected)/logout/route.ts index 26a584e45..55648c386 100644 --- a/app/[lang]/(live)/(protected)/logout/route.ts +++ b/app/[lang]/(live)/(protected)/logout/route.ts @@ -40,8 +40,6 @@ export async function GET(request: NextRequest) { try { // Initiate the seamless logout flow - const invalidateResponse = await serverClient().user.invalidateSessions() - const redirectUrl = new URL(env.SEAMLESS_LOGOUT) redirectUrl.searchParams.set("returnurl", redirectTo) redirectTo = redirectUrl.toString() diff --git a/lib/api/endpoints.ts b/lib/api/endpoints.ts index b4f8f4761..2efc39cd8 100644 --- a/lib/api/endpoints.ts +++ b/lib/api/endpoints.ts @@ -9,7 +9,6 @@ export namespace endpoints { profile = "profile/v1/Profile", upcomingStays = "booking/v1/Stays/future", previousStays = "booking/v1/Stays/past", - invalidateSessions = "profile/v1/Profile/invalidateSessions", } } diff --git a/server/routers/user/query.ts b/server/routers/user/query.ts index 124ca56b5..3f8efdedc 100644 --- a/server/routers/user/query.ts +++ b/server/routers/user/query.ts @@ -21,36 +21,6 @@ function fakingRequest(payload: T): Promise { } export const userQueryRouter = router({ - invalidateSessions: protectedProcedure.query(async function ({ ctx }) { - try { - const apiResponse = await api.post(api.endpoints.v1.invalidateSessions, { - cache: "no-store", - headers: { - Authorization: `Bearer ${ctx.session.token.access_token}`, - }, - body: {}, - }) - - if (!apiResponse.ok) { - switch (apiResponse.status) { - case 400: - throw badRequestError(apiResponse) - case 401: - throw unauthorizedError(apiResponse) - case 403: - throw forbiddenError(apiResponse) - default: - throw internalServerError(apiResponse) - } - } - return true - } catch (error) { - console.info(`Invalidate Sessions Error`) - console.error(error) - throw internalServerError() - } - }), - get: protectedProcedure.query(async function ({ ctx }) { const apiResponse = await api.get(api.endpoints.v1.profile, { cache: "no-store",