Merged in fix/SW-2631-check-session-expiry (pull request #2004)
fix(SW-2631): check if session is valid otherwise use service token * fix: check if session is valid otherwise use service token * fix: only use service token for queries and updated mutations to check for valid user token Approved-by: Michael Zetterberg
This commit is contained in:
@@ -16,6 +16,7 @@ import { auth } from "@/auth"
|
||||
import HandleErrorCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/HandleErrorCallback"
|
||||
import HandleSuccessCallback from "@/components/HotelReservation/EnterDetails/Payment/PaymentCallback/HandleSuccessCallback"
|
||||
import { encrypt } from "@/utils/encryption"
|
||||
import { isValidSession } from "@/utils/session"
|
||||
|
||||
import type { LangParams, PageArgs } from "@/types/params"
|
||||
|
||||
@@ -41,7 +42,7 @@ export default async function PaymentCallbackPage({
|
||||
|
||||
let token = ""
|
||||
const session = await auth()
|
||||
if (session) {
|
||||
if (isValidSession(session)) {
|
||||
token = session.token.access_token
|
||||
} else {
|
||||
const serviceToken = await getServiceToken()
|
||||
|
||||
Reference in New Issue
Block a user