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
18 lines
481 B
TypeScript
18 lines
481 B
TypeScript
"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 }
|
|
}
|