diff --git a/client/src/components/BookingList/BookingCard/BookingCard.tsx b/client/src/components/BookingList/BookingCard/BookingCard.tsx index 900011a66af5e6ac54ee6d4bccbca2c58785952f..29b598fd6ed675b6fc8894e9e6f1e4128b02733f 100644 --- a/client/src/components/BookingList/BookingCard/BookingCard.tsx +++ b/client/src/components/BookingList/BookingCard/BookingCard.tsx @@ -1,5 +1,5 @@ import { useLocation } from 'react-router-dom'; -import { IFlight } from '../../../services/CustomerDashboard/CustomerDashboard'; +import { IFlight } from '../../../services/Dashboard/CustomerDashboard'; import './BookingCard.scss'; interface IBookingCard { diff --git a/client/src/components/CustomerDashboard/CustomerDashboard.scss b/client/src/components/CustomerDashboard/CustomerDashboard.scss deleted file mode 100644 index def2dfbb3fe122ff60d5fcdc5014b820cce4b247..0000000000000000000000000000000000000000 --- a/client/src/components/CustomerDashboard/CustomerDashboard.scss +++ /dev/null @@ -1,120 +0,0 @@ -.customer-dashboard { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: 100%; - gap: 2rem; -} - -.avatar { - width: 150px; -} - -.customer-profile { - display: flex; - flex-direction: row; - gap: 1.5rem; -} - -.bio-card { - padding: 1.5rem 5rem !important; // Sorry -} - -.form-h { - display: flex; - flex-direction: column; - gap: 1rem; - - .form-group-h { - display: flex; - justify-content: center; - align-items: center; - gap: 1rem; - - label { - font-weight: 700; - width: 180px; - } - - input { - font-size: 1rem; - padding: 6px 12px; - border: 1px solid gray; - border-radius: 5px; - width: 300px; - } - - button { - font-size: 1rem; - padding: 6px 12px; - border: 1px solid gray; - border-radius: 5px; - background-color: var(--main); - color: white; - } - - button:hover { - filter: brightness(50%); - cursor: pointer; - } - - button:disabled { - filter: brightness(40%); - } - - button:disabled:hover { - cursor: auto; - } - - span { - overflow: hidden; - color: red; - } - } -} - -.flights-title { - font-size: 2rem; -} - -.flights { - display: flex; - flex-direction: column; - width: 80vw; - gap: 0.5rem; -} - -.flight-list { - display: flex; - gap: 1rem; -} - -.view-more { - font-size: 1rem; - padding: 6px 12px; - border: 1px solid gray; - border-radius: 5px; - background-color: var(--main); - color: white; -} - -.view-more:hover { - filter: brightness(50%); - cursor: pointer; -} - -.view_more_button { - margin-left: 10px; - font-size: 1rem; - padding: 6px 12px; - border: 1px solid gray; - border-radius: 5px; - background-color: var(--main); - color: white; -} - -.view_more_button:hover { - filter: brightness(50%); - cursor: pointer; -} \ No newline at end of file diff --git a/client/src/components/CustomerDashboard/CustomerDashboard.tsx b/client/src/components/CustomerDashboard/CustomerDashboard.tsx deleted file mode 100644 index 394312ddd9113d9e2da3e90a621b2da18be7c977..0000000000000000000000000000000000000000 --- a/client/src/components/CustomerDashboard/CustomerDashboard.tsx +++ /dev/null @@ -1,133 +0,0 @@ -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'; - -interface ICustomerDashboardForm { - name: string; - email: string; - password: string; - confirmPassword: string; -} - -function CustomerDashboard() { - const [error, setError] = useState(''); - const [disabled, setDisabled] = useState(true); - const { user } = useAuth(); - const data = useLoaderData() as ICustomerDashboardData; - const formValues: ICustomerDashboardForm = { - name: user?.username ?? '', - email: user?.email ?? '', - password: '', - confirmPassword: '' - }; - const { register, handleSubmit } = useForm<ICustomerDashboardForm>({mode: 'onChange', defaultValues: formValues}); - - const toggleEdit = () => { - setDisabled(!disabled); - }; - - const onSubmit = (formValue: ICustomerDashboardForm) => { - if (formValue.password.length < 7) { - setError('password length must be greater than 7 characters'); - return; - } - - if (formValue.password !== formValue.confirmPassword) { - setError('password and confirm password must match'); - return; - } - - setError(''); - console.log('ready to make update details api call'); - }; - - return ( - <> - <div className='customer-dashboard'> - <div className='customer-profile'> - <div className='customer-profile-bio'> - <div className='card bio-card'> - <div className='flex'> - <img src={avatar} alt='avatar' className='avatar'></img> - <span>{user?.username ?? ''}</span> - <span>Loyal Customer</span> - </div> - </div> - </div> - - <div className='customer-profile-fields'> - <div className='card'> - <form onSubmit={handleSubmit(onSubmit)}> - <div className='form-h'> - <div className='form-group-h'> - <label>Full Name</label> - <input type='text' {...register('name', { required: true, disabled })} /> - </div> - - <div className='form-group-h'> - <label>Email</label> - <input type='email' {...register('email', { required: true, disabled })} /> - </div> - - <div className='form-group-h'> - <label>Password</label> - <input type='password' placeholder='Enter new password' {...register('password', { required: true, disabled })} /> - </div> - - <div className='form-group-h'> - <label>Confirm Password</label> - <input type='password' placeholder='Confirm new password' {...register('confirmPassword', { required: true, disabled })} /> - </div> - - <div className='form-group-h'> - <button type='button' onClick={toggleEdit}>Toggle Edit</button> - <button type='submit' disabled={disabled}>Submit</button> - </div> - - <div className='form-group-h'> - {error && <span>{error}</span>} - </div> - </div> - </form> - </div> - </div> - </div> - - <div className='flights'> - <div className='flex-row'> - <span className='flights-title'>Upcoming Flights</span> - <button type='submit' className='view_more_button'>View more</button> - </div> - <div className='flight-list'> - {data.upcomingFlights.length > 0 - ? data.upcomingFlights.map((flight) => { - return <FlightCard key={flight.id} flight={flight}></FlightCard> - }) - : <div>No Upcoming Flights</div>} - </div> - </div> - - <div className='flights'> - <div className='flex-row'> - <span className='flights-title'>Flights History</span> - <button type='submit' className='view_more_button'>View more</button> - </div> - <div className='flight-list'> - {data.upcomingFlights.length > 0 - ? data.flightsHistory.map((flight) => { - return <FlightCard key={flight.id} flight={flight}></FlightCard> - }) - : <div>No Flights History</div>} - </div> - </div> - </div> - </> - ); -} - -export default CustomerDashboard; \ No newline at end of file diff --git a/client/src/components/Dashboard/Dashboard.scss b/client/src/components/Dashboard/Dashboard.scss new file mode 100644 index 0000000000000000000000000000000000000000..a825b413dae530740a99053cbe67b19b36fced30 --- /dev/null +++ b/client/src/components/Dashboard/Dashboard.scss @@ -0,0 +1,8 @@ +.dashboard { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; + gap: 2rem; +} diff --git a/client/src/components/Dashboard/Dashboard.tsx b/client/src/components/Dashboard/Dashboard.tsx new file mode 100644 index 0000000000000000000000000000000000000000..7521039d46847bd76a6749e1153f7676c88d4ba4 --- /dev/null +++ b/client/src/components/Dashboard/Dashboard.tsx @@ -0,0 +1,16 @@ +import Profile from './Profile/Profile'; +import Flights from './Flights/Flights'; +import './Dashboard.scss'; + +function Dashboard() { + return ( + <> + <div className='dashboard'> + <Profile></Profile> + <Flights></Flights> + </div> + </> + ); +} + +export default Dashboard; diff --git a/client/src/components/CustomerDashboard/FlightCard/FlightCard.scss b/client/src/components/Dashboard/FlightCard/FlightCard.scss similarity index 99% rename from client/src/components/CustomerDashboard/FlightCard/FlightCard.scss rename to client/src/components/Dashboard/FlightCard/FlightCard.scss index 639c3a9598ca594a7abf90b6cb70ff7498ba02ce..8163853c6a9205753faa0b1270484b1eec3dda55 100644 --- a/client/src/components/CustomerDashboard/FlightCard/FlightCard.scss +++ b/client/src/components/Dashboard/FlightCard/FlightCard.scss @@ -13,4 +13,4 @@ .flight-path { color: #777; font-size: 0.8rem; -} \ No newline at end of file +} diff --git a/client/src/components/CustomerDashboard/FlightCard/FlightCard.tsx b/client/src/components/Dashboard/FlightCard/FlightCard.tsx similarity index 95% rename from client/src/components/CustomerDashboard/FlightCard/FlightCard.tsx rename to client/src/components/Dashboard/FlightCard/FlightCard.tsx index 9e20e2b1af7b11c7302a951085858012948aad26..32125e5141f5dce5a04af7ef30381ba35a912b7f 100644 --- a/client/src/components/CustomerDashboard/FlightCard/FlightCard.tsx +++ b/client/src/components/Dashboard/FlightCard/FlightCard.tsx @@ -25,4 +25,4 @@ function FlightCard({ flight }: IFlightCard) { ); } -export default FlightCard; \ No newline at end of file +export default FlightCard; diff --git a/client/src/components/Dashboard/Flights/Flights.scss b/client/src/components/Dashboard/Flights/Flights.scss new file mode 100644 index 0000000000000000000000000000000000000000..9cabf460c2016b19398d619f43069a435bc92294 --- /dev/null +++ b/client/src/components/Dashboard/Flights/Flights.scss @@ -0,0 +1,30 @@ +.flights-title { + font-size: 2rem; +} + +.flights { + display: flex; + flex-direction: column; + width: 80vw; + gap: 0.5rem; +} + +.flight-list { + display: flex; + gap: 1rem; +} + +.view-more { + margin-left: 10px; + font-size: 1rem; + padding: 6px 12px; + border: 1px solid gray; + border-radius: 5px; + background-color: var(--main); + color: white; +} + +.view-more:hover { + filter: brightness(50%); + cursor: pointer; +} diff --git a/client/src/components/Dashboard/Flights/Flights.tsx b/client/src/components/Dashboard/Flights/Flights.tsx new file mode 100644 index 0000000000000000000000000000000000000000..96ff31977bdb012b17424152f48ee788f1fa9cc7 --- /dev/null +++ b/client/src/components/Dashboard/Flights/Flights.tsx @@ -0,0 +1,54 @@ +import { useLoaderData } from 'react-router'; +import { ICustomerDashboardData } from '../../../services/Dashboard/CustomerDashboard'; +import { IAirlineDashboardData } from '../../../services/Dashboard/AirlineDashboard'; +import FlightCard from '../FlightCard/FlightCard'; +import './Flights.scss'; + +function Flights() { + const data = useLoaderData() as ICustomerDashboardData | IAirlineDashboardData; + + if (data.type === 'customer') { + return ( + <> + <div className='flights'> + <div className='flex-row'> + <span className='flights-title'>Upcoming Flights</span> + <button type='submit' className='view-more'>View more</button> + </div> + <div className='flight-list'> + {data.upcomingFlights.length > 0 + ? data.upcomingFlights.map((flight) => { + return <FlightCard key={flight.id} flight={flight}></FlightCard> + }) + : <div>No Upcoming Flights</div>} + </div> + </div> + + <div className='flights'> + <div className='flex-row'> + <span className='flights-title'>Flights History</span> + <button type='submit' className='view-more'>View more</button> + </div> + <div className='flight-list'> + {data.upcomingFlights.length > 0 + ? data.flightsHistory.map((flight) => { + return <FlightCard key={flight.id} flight={flight}></FlightCard> + }) + : <div>No Flights History</div>} + </div> + </div> + </> + ); + } else { + return ( + <> + <div> + todo airline dashboard + </div> + </> + ); + } + +} + +export default Flights; diff --git a/client/src/components/Dashboard/Profile/Profile.scss b/client/src/components/Dashboard/Profile/Profile.scss new file mode 100644 index 0000000000000000000000000000000000000000..6db01b1a27a3943a9669fa6e69201ef5490b2e82 --- /dev/null +++ b/client/src/components/Dashboard/Profile/Profile.scss @@ -0,0 +1,13 @@ +.profile { + display: flex; + flex-direction: row; + gap: 1.5rem; +} + +.bio-card { + padding: 1.5rem 5rem !important; // Sorry +} + +.avatar { + width: 150px; +} diff --git a/client/src/components/Dashboard/Profile/Profile.tsx b/client/src/components/Dashboard/Profile/Profile.tsx new file mode 100644 index 0000000000000000000000000000000000000000..f2895940b8ac6f2ff3fe2867d309e11ed089b6c8 --- /dev/null +++ b/client/src/components/Dashboard/Profile/Profile.tsx @@ -0,0 +1,114 @@ +import { useState } from 'react'; +import { useForm } from 'react-hook-form'; +import { useAuth } from '../../../hooks/useAuth'; +import avatar from './avatar.jpg'; +import plane from './airplane.jpg'; +import './Profile.scss'; + +interface IProfileForm { + name: string; + email: string; + password: string; + confirmPassword: string; +} + +function Profile() { + const { user } = useAuth(); + const [disabled, setDisabled] = useState(true); + const [error, setError] = useState(''); + const isAirline = user?.type === 1; + const defaultValues: IProfileForm = { + email: user?.email ?? '', + name: user?.username ?? '', + password: '', + confirmPassword: '' + }; + const { register, handleSubmit, getValues, setValue } = useForm<IProfileForm>({ mode: 'onChange', defaultValues }); + + const resetFormValues = () => { + if (!getValues().name) + setValue('name', user?.username ?? ''); + + if (!getValues().email) + setValue('email', user?.email ?? ''); + + if (!getValues().password) + setValue('password', ''); + + if (!getValues().confirmPassword) + setValue('confirmPassword', ''); + }; + + resetFormValues(); + + const toggleEdit = () => { + setDisabled(!disabled); + resetFormValues(); + }; + + const onSubmit = (formValue: IProfileForm) => { + if (formValue.password.length < 7) { + setError('password length must be greater than 7 characters'); + return; + } + + if (formValue.password !== formValue.confirmPassword) { + setError('password and confirm password must match'); + return; + } + + setError(''); + console.log('ready to make update details api call'); + }; + + return ( + <> + <div className='profile'> + <div className='card bio-card'> + <div className='flex'> + <img src={isAirline ? plane : avatar} alt='avatar' className='avatar'></img> + <span>{user?.username ?? ''}</span> + <span>Loyal {isAirline ? 'Airline' : 'Customer'}</span> + </div> + </div> + + <div className='card'> + <form onSubmit={handleSubmit(onSubmit)}> + <div className='form-h'> + <div className='form-group-h'> + <label>Full Name</label> + <input type='text' {...register('name', { required: true, disabled })} /> + </div> + + <div className='form-group-h'> + <label>Email</label> + <input type='email' {...register('email', { required: true, disabled })} /> + </div> + + <div className='form-group-h'> + <label>Password</label> + <input type='password' placeholder='Enter new password' {...register('password', { required: true, disabled })} /> + </div> + + <div className='form-group-h'> + <label>Confirm Password</label> + <input type='password' placeholder='Confirm new password' {...register('confirmPassword', { required: true, disabled })} /> + </div> + + <div className='form-group-h'> + <button type='button' onClick={toggleEdit}>Toggle Edit</button> + <button type='submit' disabled={disabled}>Submit</button> + </div> + + <div className='form-group-h'> + {error && <span>{error}</span>} + </div> + </div> + </form> + </div> + </div> + </> + ); +} + +export default Profile; diff --git a/client/src/components/Dashboard/Profile/airplane.jpg b/client/src/components/Dashboard/Profile/airplane.jpg new file mode 100644 index 0000000000000000000000000000000000000000..20b46345cfaf2caf79d4999c0d0641f9a40053df Binary files /dev/null and b/client/src/components/Dashboard/Profile/airplane.jpg differ diff --git a/client/src/components/CustomerDashboard/avatar.jpg b/client/src/components/Dashboard/Profile/avatar.jpg similarity index 100% rename from client/src/components/CustomerDashboard/avatar.jpg rename to client/src/components/Dashboard/Profile/avatar.jpg diff --git a/client/src/components/Header/Header.tsx b/client/src/components/Header/Header.tsx index cd7ac92ff6dbd3560c4eca45c8a404be2f385178..4128437f63217bbc68ef527c4d634177b87d57eb 100644 --- a/client/src/components/Header/Header.tsx +++ b/client/src/components/Header/Header.tsx @@ -1,10 +1,11 @@ import { Link } from 'react-router-dom'; import { useAuth } from '../../hooks/useAuth'; import './Header.scss'; +import { userToDashboard } from '../../helpers/UserType'; function Header() { - const { isAuth } = useAuth(); - + const { isAuth, user } = useAuth(); + return ( <> <div className='header'> @@ -16,6 +17,7 @@ function Header() { {isAuth ? <div> + <Link to={userToDashboard(user)} className='nav-item'>Dashboard</Link> <Link to={'booking/query'} className='nav-item'>Book a Flight</Link> <Link to={'logout'} className='nav-item'>Logout</Link> </div> : @@ -30,4 +32,4 @@ function Header() { ); } -export default Header; \ No newline at end of file +export default Header; diff --git a/client/src/components/Login/Login.tsx b/client/src/components/Login/Login.tsx index 271ba52399d798e5a2be136964972ec02bea315d..0eeeacbb9d6cf19c18d91d46ea396fcbd23bfd52 100644 --- a/client/src/components/Login/Login.tsx +++ b/client/src/components/Login/Login.tsx @@ -4,6 +4,7 @@ import { useForm } from 'react-hook-form'; import { AxiosError } from 'axios'; import { useAuth } from '../../hooks/useAuth'; import { loginUser } from '../../services/Login/Login'; +import { userToDashboard } from '../../helpers/UserType'; import './Login.scss'; export interface ILoginForm { @@ -12,7 +13,7 @@ export interface ILoginForm { } export function Login() { - const { giveAuth, updateUser } = useAuth(); + const { giveAuth, updateUser, user } = useAuth(); const navigate = useNavigate(); const [error, setError] = useState(''); const { register, handleSubmit } = useForm<ILoginForm>({mode: 'onChange'}); @@ -24,7 +25,7 @@ export function Login() { const result = await loginUser(formValue); giveAuth(); updateUser(result.data); - navigate('/customer-dashboard'); + navigate(`/${userToDashboard(user)}`); } catch (error) { const errorMessage = (error as AxiosError).response?.data; diff --git a/client/src/components/Register/Register.tsx b/client/src/components/Register/Register.tsx index 7a431c62ef55779c491617f0c54ffdc3ea301aa0..ea69c77e51851277e170a791e9aa666d2a3f2b14 100644 --- a/client/src/components/Register/Register.tsx +++ b/client/src/components/Register/Register.tsx @@ -5,6 +5,7 @@ import { AxiosError } from 'axios'; import { registerUser } from '../../services/Register/Register'; import { useAuth } from '../../hooks/useAuth'; import './Register.scss'; +import { userToDashboard } from '../../helpers/UserType'; export interface IRegisterForm { name: string; @@ -15,7 +16,7 @@ export interface IRegisterForm { } export function Register() { - const { giveAuth, updateUser } = useAuth(); + const { giveAuth, updateUser, user } = useAuth(); const navigate = useNavigate(); const [error, setError] = useState(''); const { register, handleSubmit } = useForm<IRegisterForm>({mode: 'onChange'}); @@ -37,7 +38,7 @@ export function Register() { const result = await registerUser(formValue); giveAuth(); updateUser(result.data); - navigate('/customer-dashboard'); + navigate(`/${userToDashboard(user)}`); } catch (error) { const errorMessage = (error as AxiosError).response?.data; @@ -96,4 +97,4 @@ export function Register() { ); } -export default Register; \ No newline at end of file +export default Register; diff --git a/client/src/helpers/UserType.ts b/client/src/helpers/UserType.ts index 46ca75abfa9f7b446e7dfc3d344bc9516aa2ba09..463e644a1242397257908d2d7e72217de46ed105 100644 --- a/client/src/helpers/UserType.ts +++ b/client/src/helpers/UserType.ts @@ -1,3 +1,10 @@ +import { IUser } from '../providers/AuthProvider'; + export function userStringToType(user: string) { return user.toLowerCase() === 'customer' ? 0 : 1; } + +export function userToDashboard(user?: IUser) { + const isAirline = user?.type === 1; + return isAirline ? 'airline-dashboard' : 'customer-dashboard'; +} diff --git a/client/src/index.scss b/client/src/index.scss index 0f7974e7a6d96776691e3a1b1304d819323fba6d..9579f87760b28b786df570227256ab5c306bf98f 100644 --- a/client/src/index.scss +++ b/client/src/index.scss @@ -76,6 +76,59 @@ body { } } +.form-h { + display: flex; + flex-direction: column; + gap: 1rem; + + .form-group-h { + display: flex; + justify-content: center; + align-items: center; + gap: 1rem; + + label { + font-weight: 700; + width: 180px; + } + + input { + font-size: 1rem; + padding: 6px 12px; + border: 1px solid gray; + border-radius: 5px; + width: 300px; + } + + button { + font-size: 1rem; + padding: 6px 12px; + border: 1px solid gray; + border-radius: 5px; + background-color: var(--main); + color: white; + } + + button:hover { + filter: brightness(50%); + cursor: pointer; + } + + button:disabled { + filter: brightness(40%); + } + + button:disabled:hover { + cursor: auto; + } + + span { + overflow: hidden; + color: red; + } + } +} + .flex { display: flex; flex-direction: column; diff --git a/client/src/main.tsx b/client/src/main.tsx index 54cf1485cddff0f71f975071c934d44d417096fb..6e9c4d9b9095218974ed1a2de7663a3ebec0d74e 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -6,12 +6,13 @@ import Login from './components/Login/Login.tsx'; import Register from './components/Register/Register.tsx'; import Logout from './components/Logout/Logout.tsx'; import ProtectedRoute from './components/ProtectedRoute/ProtectedRoute.tsx'; -import CustomerDashboard from './components/CustomerDashboard/CustomerDashboard.tsx'; +import Dashboard from './components/Dashboard/Dashboard.tsx'; import BookingQuery from './components/BookingQuery/BookingQuery.tsx'; import BookingList from './components/BookingList/BookingList.tsx'; import { AuthoriseUser } from './services/Authorise/Authorise.ts'; import { LogoutUser } from './services/Logout/Logout.ts'; -import { GetCustomerDashboardData } from './services/CustomerDashboard/CustomerDashboard.ts'; +import { GetCustomerDashboardData } from './services/Dashboard/CustomerDashboard.ts'; +import { GetAirlineDashboardData } from './services/Dashboard/AirlineDashboard.ts'; import { GetBookingList } from './services/BookingList/BookingList.ts'; import './index.scss'; @@ -40,7 +41,12 @@ const router = createBrowserRouter([ { path: 'customer-dashboard', loader: GetCustomerDashboardData, - element: <CustomerDashboard></CustomerDashboard> + element: <Dashboard></Dashboard> + }, + { + path: 'airline-dashboard', + loader: GetAirlineDashboardData, + element: <Dashboard></Dashboard> }, { path: 'booking/query', diff --git a/client/src/services/BookingList/BookingList.ts b/client/src/services/BookingList/BookingList.ts index 985a3594c6ccdbc89af88d23ecc4f67f4b7ea545..84487d8967f77ccfe1881e51c8ae5ad0c1cde6b1 100644 --- a/client/src/services/BookingList/BookingList.ts +++ b/client/src/services/BookingList/BookingList.ts @@ -1,5 +1,5 @@ import { getSearchParam } from '../../helpers/SearchParams'; -import { IFlight } from '../CustomerDashboard/CustomerDashboard'; +import { IFlight } from '../Dashboard/CustomerDashboard'; export interface IBookingList { diff --git a/client/src/services/Dashboard/AirlineDashboard.ts b/client/src/services/Dashboard/AirlineDashboard.ts new file mode 100644 index 0000000000000000000000000000000000000000..3600759203a56849066fbb9075b6e8847218dedc --- /dev/null +++ b/client/src/services/Dashboard/AirlineDashboard.ts @@ -0,0 +1,9 @@ +export interface IAirlineDashboardData { + type: 'airline' +} + +export async function GetAirlineDashboardData(): Promise<IAirlineDashboardData> { + return { + type: 'airline' + }; +} diff --git a/client/src/services/CustomerDashboard/CustomerDashboard.ts b/client/src/services/Dashboard/CustomerDashboard.ts similarity index 98% rename from client/src/services/CustomerDashboard/CustomerDashboard.ts rename to client/src/services/Dashboard/CustomerDashboard.ts index e8c79844812345d29efb1e1a4c1071adc7ad37f3..a9338d5b87f864c8d62fa31d647e7b827874998b 100644 --- a/client/src/services/CustomerDashboard/CustomerDashboard.ts +++ b/client/src/services/Dashboard/CustomerDashboard.ts @@ -1,4 +1,3 @@ - export interface IFlight { id: number; flightNumber: string; @@ -11,12 +10,15 @@ export interface IFlight { } export interface ICustomerDashboardData { + type: 'customer' upcomingFlights: IFlight[]; flightsHistory: IFlight[]; } export async function GetCustomerDashboardData(): Promise<ICustomerDashboardData> { + return { + type: 'customer', upcomingFlights: [ { id: 4, @@ -82,4 +84,4 @@ export async function GetCustomerDashboardData(): Promise<ICustomerDashboardData } ] } -} \ No newline at end of file +}