diff --git a/client/src/components/Dashboard/FlightCard/FlightCard.tsx b/client/src/components/Dashboard/FlightCard/FlightCard.tsx index dd3a9987bf80db4de611bd2c0a61c827f4f92ecd..c7ceb5ab5e4b09e3ffb5791dfb3cf644390ff784 100644 --- a/client/src/components/Dashboard/FlightCard/FlightCard.tsx +++ b/client/src/components/Dashboard/FlightCard/FlightCard.tsx @@ -1,6 +1,5 @@ import { Link } from 'react-router-dom'; import { IFlight } from '../../../services/Dashboard/CustomerDashboard'; -import { airportCode } from '../../../helpers/Airports'; import './FlightCard.scss'; interface IFlightCard { @@ -8,7 +7,7 @@ interface IFlightCard { extraInfo?: boolean; } -function FlightCard({ flight, extraInfo }: IFlightCard) { +function FlightCard({ flight }: IFlightCard) { return ( <> diff --git a/client/src/components/Login/Login.tsx b/client/src/components/Login/Login.tsx index edb557747a2fba32d18c7096a950116fd824f281..c3baf71b330073a6ad95f4d41f741ceb65d39737 100644 --- a/client/src/components/Login/Login.tsx +++ b/client/src/components/Login/Login.tsx @@ -26,7 +26,7 @@ export function Login() { const result = await loginUser(formValue); if (result) { giveAuth(); - const userId = result.data.id; + const userId = result.data.id.toString(); UserStorage.storeUserId(userId) updateUser(result.data); navigate(`/${userToDashboard(result.data)}`); diff --git a/client/src/components/Register/Register.tsx b/client/src/components/Register/Register.tsx index e44fae177b10afb86bd5cb0e00579f1cd90017c5..c188dad6199c76d6dc17a2b647d78a167b3c6f8c 100644 --- a/client/src/components/Register/Register.tsx +++ b/client/src/components/Register/Register.tsx @@ -40,7 +40,7 @@ export function Register() { try { const result = await registerUser(formValue); giveAuth(); - const userId = result.data.id; + const userId = result.data.id.toString(); UserStorage.storeUserId(userId); updateUser(result.data); navigate(`/${userToDashboard(result.data)}`); diff --git a/client/src/helpers/UserStorage.ts b/client/src/helpers/UserStorage.ts new file mode 100644 index 0000000000000000000000000000000000000000..638c33263d05a888514727f6ab3844916f9eb6c7 --- /dev/null +++ b/client/src/helpers/UserStorage.ts @@ -0,0 +1,11 @@ +class UserStorage { + static storeUserId(id: string): void { + localStorage.setItem('userId', id); + } + + static getUserId(): string | null { + return localStorage.getItem('userId'); + } + } + + export default UserStorage; \ No newline at end of file diff --git a/client/src/services/Dashboard/AirlineDashboard.ts b/client/src/services/Dashboard/AirlineDashboard.ts index b08849969a690ca3e6ce76cbb31a1ca228552fda..d697d38c8e6845cb9b4f9fed1a60e1298e65dc3e 100644 --- a/client/src/services/Dashboard/AirlineDashboard.ts +++ b/client/src/services/Dashboard/AirlineDashboard.ts @@ -31,11 +31,7 @@ export interface IAirlineDashboardData { flightList: IFlight[]; } -export async function GetAirlineDashboardData({ - request, -}: { - request: Request; -}): Promise<IAirlineDashboardData> { +export async function GetAirlineDashboardData(): Promise<IAirlineDashboardData> { try { const id = UserStorage.getUserId(); const response = await Api.get(`Flight?airlineId=${id}`, {