diff --git a/src/App.tsx b/src/App.tsx index ed2333f..22575ed 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,14 +13,10 @@ import { BuyReturn } from "./pages/BuyReturn.tsx"; import { Grid, Paper } from "@mui/material"; function App() { - const locallyStoredUserId = window.localStorage.getItem("paysplit-user-id"); - const locallyStoredUserIdAsNumber = locallyStoredUserId - ? parseInt(locallyStoredUserId) - : null; - const [userId, setUserId] = useState( - locallyStoredUserIdAsNumber, + const [userId, setUserId] = useState( + window.localStorage.getItem("paysplit-user-id") ); - const storeUserId = (id: number) => { + const storeUserId = (id: string) => { window.localStorage.setItem("paysplit-user-id", id.toString()); setUserId(id); }; diff --git a/src/api/client.ts b/src/api/client.ts index e3e22cf..4ed6064 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -1,7 +1,7 @@ import axios, { type AxiosResponse } from "axios"; interface AccessResponse { - userId: number; + userId: string; } export const login = (name: string, password: string) => @@ -16,12 +16,12 @@ export const registerUser = (name: string, password: string) => password, }) as Promise>; -export const startBuyFlow = (userId: number, quantity: number) => +export const startBuyFlow = (userId: string, quantity: number) => axios.post("/buy/start", { userId, quantity }) as Promise< AxiosResponse<{ url: string }, unknown, {}> >; -export const completeBuyFlow = (userId: number) => +export const completeBuyFlow = (userId: string) => axios.post("/buy/complete", { userId }) as Promise< AxiosResponse<{ url: string }, unknown, {}> >; diff --git a/src/context/logged-in-page-context.ts b/src/context/logged-in-page-context.ts index d8d9bc8..b3f590b 100644 --- a/src/context/logged-in-page-context.ts +++ b/src/context/logged-in-page-context.ts @@ -1,7 +1,7 @@ import { createContext } from "react"; interface LoggedInPageContextProps { - userId: number; + userId: string; } export const LoggedInPageContext = diff --git a/src/context/pre-login-page-context.ts b/src/context/pre-login-page-context.ts index 089681d..353280b 100644 --- a/src/context/pre-login-page-context.ts +++ b/src/context/pre-login-page-context.ts @@ -1,7 +1,7 @@ import { createContext } from "react"; interface PreLoginPageContextProps { - setUserId: (id: number) => void; + setUserId: (id: string) => void; } export const PreLoginPageContext =