Skip to content
Snippets Groups Projects
Commit 898bc6f4 authored by Cross, Liam (UG - Comp Sci & Elec Eng)'s avatar Cross, Liam (UG - Comp Sci & Elec Eng)
Browse files

Merge branch 'LC/dashboard-data' into 'main'

Use real data in customer dashboard profile

See merge request ma03081/COM3014!17
parents adefa1a0 5acfae0d
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import { useState } from 'react';
import { useLoaderData } from 'react-router-dom';
import { useForm } from 'react-hook-form';
import { ICustomerDashboardData } from '../../services/CustomerDashboard/CustomerDashboard';
import { useAuth } from '../../hooks/useAuth';
import FlightCard from './FlightCard/FlightCard';
import avatar from './avatar.jpg';
import './CustomerDashboard.scss';
......@@ -16,10 +17,11 @@ interface ICustomerDashboardForm {
function CustomerDashboard() {
const [error, setError] = useState('');
const [disabled, setDisabled] = useState(true);
const { user } = useAuth();
const data = useLoaderData() as ICustomerDashboardData;
const formValues: ICustomerDashboardForm = {
name: data.name,
email: data.email,
name: user?.username ?? '',
email: user?.email ?? '',
password: '',
confirmPassword: ''
};
......@@ -52,7 +54,7 @@ function CustomerDashboard() {
<div className='card bio-card'>
<div className='flex'>
<img src={avatar} alt='avatar' className='avatar'></img>
<span>{data.name}</span>
<span>{user?.username ?? ''}</span>
<span>Loyal Customer</span>
</div>
</div>
......
......@@ -11,16 +11,12 @@ export interface IFlight {
}
export interface ICustomerDashboardData {
name: string;
email: string;
upcomingFlights: IFlight[];
flightsHistory: IFlight[];
}
export async function GetCustomerDashboardData(): Promise<ICustomerDashboardData> {
return {
name: 'fname lname',
email: 'test@test.com',
upcomingFlights: [
{
id: 4,
......
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