Merged in feat/SW-3494-noOfNightsStayed (pull request #2832)
feat(SW-3494): removed properties that we dont need in the tracking * feat(SW-3494): removed properties that we dont need in the tracking * Fixed waiting on user response before tracking * Refactor and cleanup * Cleanup Approved-by: Joakim Jäderberg
This commit is contained in:
17
packages/tracking/lib/useTrackingUserData.ts
Normal file
17
packages/tracking/lib/useTrackingUserData.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
"use client"
|
||||
|
||||
import { trpc } from "@scandic-hotels/trpc/client"
|
||||
|
||||
import type { TrackingSDKUserData } from "./types"
|
||||
|
||||
export const useTrackingUserData = () => {
|
||||
const { data, isError, isPending } = trpc.user.userTrackingInfo.useQuery()
|
||||
|
||||
const userData: TrackingSDKUserData | undefined = !isPending
|
||||
? isError || !data
|
||||
? ({ loginStatus: "Error" } as const)
|
||||
: { ...data, memberType: "scandic-friends" }
|
||||
: undefined
|
||||
|
||||
return { userData, isPending, isError }
|
||||
}
|
||||
Reference in New Issue
Block a user