chore: remove invalidateSession
This commit is contained in:
@@ -40,8 +40,6 @@ export async function GET(request: NextRequest) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Initiate the seamless logout flow
|
// Initiate the seamless logout flow
|
||||||
const invalidateResponse = await serverClient().user.invalidateSessions()
|
|
||||||
|
|
||||||
const redirectUrl = new URL(env.SEAMLESS_LOGOUT)
|
const redirectUrl = new URL(env.SEAMLESS_LOGOUT)
|
||||||
redirectUrl.searchParams.set("returnurl", redirectTo)
|
redirectUrl.searchParams.set("returnurl", redirectTo)
|
||||||
redirectTo = redirectUrl.toString()
|
redirectTo = redirectUrl.toString()
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export namespace endpoints {
|
|||||||
profile = "profile/v1/Profile",
|
profile = "profile/v1/Profile",
|
||||||
upcomingStays = "booking/v1/Stays/future",
|
upcomingStays = "booking/v1/Stays/future",
|
||||||
previousStays = "booking/v1/Stays/past",
|
previousStays = "booking/v1/Stays/past",
|
||||||
invalidateSessions = "profile/v1/Profile/invalidateSessions",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,36 +21,6 @@ function fakingRequest<T>(payload: T): Promise<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const userQueryRouter = router({
|
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 }) {
|
get: protectedProcedure.query(async function ({ ctx }) {
|
||||||
const apiResponse = await api.get(api.endpoints.v1.profile, {
|
const apiResponse = await api.get(api.endpoints.v1.profile, {
|
||||||
cache: "no-store",
|
cache: "no-store",
|
||||||
|
|||||||
Reference in New Issue
Block a user