Merged in fix/book-516 (pull request #3093)
feat(BOOK-516): check valid token * feat(BOOK-516): check valid token Approved-by: Joakim Jäderberg
This commit is contained in:
committed by
Joakim Jäderberg
parent
f502621576
commit
0a5d3ef7c3
@@ -11,6 +11,7 @@ import {
|
|||||||
appServerClient,
|
appServerClient,
|
||||||
configureServerClient,
|
configureServerClient,
|
||||||
} from "@scandic-hotels/trpc/serverClient"
|
} from "@scandic-hotels/trpc/serverClient"
|
||||||
|
import { isValidSession } from "@scandic-hotels/trpc/utils/session"
|
||||||
|
|
||||||
import { webviews } from "@/constants/routes/webviews"
|
import { webviews } from "@/constants/routes/webviews"
|
||||||
|
|
||||||
@@ -50,6 +51,9 @@ export async function createAppContext() {
|
|||||||
auth: async () => await getUserSession(),
|
auth: async () => await getUserSession(),
|
||||||
getScandicUserToken: async () => {
|
getScandicUserToken: async () => {
|
||||||
const session = await getUserSession()
|
const session = await getUserSession()
|
||||||
|
if (!isValidSession(session)) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
return session?.token?.access_token ?? null
|
return session?.token?.access_token ?? null
|
||||||
},
|
},
|
||||||
getUserPointsBalance: async () => {
|
getUserPointsBalance: async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user