feat(WEB-169): get profile data from API

This commit is contained in:
Simon Emanuelsson
2024-04-16 12:42:44 +02:00
parent d2c1887179
commit 55794034c5
44 changed files with 632 additions and 607 deletions

11
types/auth.d.ts vendored
View File

@@ -1,4 +1,4 @@
import "next-auth"
import type { JWT } from "next-auth/jwt"
// Module augmentation
// https://authjs.dev/getting-started/typescript#popular-interfaces-to-augment
@@ -20,10 +20,7 @@ declare module "next-auth" {
/**
* Returned by `useSession`, `auth`, contains information about the active session.
*/
interface Session {}
}
declare module "next-auth/jwt" {
/** Returned by the `jwt` callback and `auth`, when using JWT sessions */
interface JWT {}
interface Session {
token: JWT
}
}

View File

@@ -0,0 +1,6 @@
import type { CardProps } from "./card/card"
import type { User } from "@/types/user"
export interface ContainerProps extends CardProps {
user: User
}

View File

@@ -1,5 +0,0 @@
import type { User } from "@/types/user"
export interface ProfileProps extends React.HTMLAttributes<HTMLElement> {
user: User
}

7
types/fetch.ts Normal file
View File

@@ -0,0 +1,7 @@
export interface RequestOptionsWithJSONBody
extends Omit<RequestInit, "body" | "method"> {
body: Record<string, unknown>
}
export interface RequestOptionsWithOutBody
extends Omit<RequestInit, "body" | "method"> {}

8
types/jwt.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Module augmentation
// https://authjs.dev/getting-started/typescript#popular-interfaces-to-augment
declare module "next-auth/jwt" {
/** Returned by the `jwt` callback and `auth`, when using JWT sessions */
interface JWT {
access_token: string
}
}

8
types/next/error.ts Normal file
View File

@@ -0,0 +1,8 @@
interface NextError extends Error {
digest?: string
}
export interface ErrorPage {
error: NextError
reset: () => void
}

View File

@@ -24,16 +24,15 @@ type Victory = {
title: string
}
/**
* All extended field needs to be added by API team to response or
* we have to get the values from elsewhere
*/
export interface User extends z.infer<typeof getUserSchema> {
country: string
dob: string
firstname: string
firstName: string
journeys: Journey[]
lastname: string
membershipId: number
nights: number
points: number
qualifyingPoints: number
shortcuts: ShortcutLink[]
stays: Stay[]
victories: Victory[]