Skip to content
Snippets Groups Projects
Commit 71f67402 authored by Abdelsamad, Mouaz R (UG - SISC)'s avatar Abdelsamad, Mouaz R (UG - SISC)
Browse files

show the flights for the actual airline

parent 0dca037e
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ import { AxiosError } from 'axios';
import { useAuth } from '../../hooks/useAuth';
import { loginUser } from '../../services/Login/Login';
import { userToDashboard } from '../../helpers/UserType';
import UserStorage from "../../helpers/UserStorage";
import './Login.scss';
export interface ILoginForm {
......@@ -25,6 +26,8 @@ export function Login() {
const result = await loginUser(formValue);
if (result) {
giveAuth();
const userId = result.data.id;
UserStorage.storeUserId(userId)
updateUser(result.data);
navigate(`/${userToDashboard(result.data)}`);
} else {
......
......@@ -6,6 +6,7 @@ import { registerUser } from '../../services/Register/Register';
import { useAuth } from '../../hooks/useAuth';
import './Register.scss';
import { userToDashboard } from '../../helpers/UserType';
import UserStorage from "../../helpers/UserStorage";
export interface IRegisterForm {
name: string;
......@@ -37,6 +38,8 @@ export function Register() {
try {
const result = await registerUser(formValue);
giveAuth();
const userId = result.data.id;
UserStorage.storeUserId(userId)
updateUser(result.data);
navigate(`/${userToDashboard(result.data)}`);
} catch (error) {
......
import Api from "../../helpers/Api";
import { getSearchParam } from "../../helpers/SearchParams";
import UserStorage from "../../helpers/UserStorage";
export interface ISeat {
id: number;
......@@ -33,7 +33,7 @@ export interface IAirlineDashboardData {
export async function GetAirlineDashboardData({request}: {request: Request}): Promise<IAirlineDashboardData> {
try {
const id = getSearchParam(request.url, 'id');
const id = UserStorage.getUserId();
const response = await Api.get(`Flight?airlineId=${id}`, { withCredentials: true });
const flights = response.data.$values;
return {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment