move some parts to services and introduce the backend communication for the airports
This commit is contained in:
1 parent
914048fadf
commit
5c9352c362
4 files changed
+20
-1
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { Button } from 'primereact/button';
|
import { Button } from 'primereact/button';
|
||||||
import { Card } from 'primereact/card';
|
import { Card } from 'primereact/card';
|
||||||
import { Configuration } from './configuration';
|
import { Configuration } from '../services';
|
||||||
|
|
||||||
export const Login: React.FC = () => {
|
export const Login: React.FC = () => {
|
||||||
// reset every old token
|
// reset every old token
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
import { Configuration } from './configuration';
|
||||||
|
import { AirportOverview } from '../types';
|
||||||
|
|
||||||
|
export class Airport {
|
||||||
|
static async all(): Promise<AirportOverview[]> {
|
||||||
|
return axios
|
||||||
|
.get<AirportOverview[]>(`${Configuration.resourceServer}/airport/all`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${sessionStorage.getItem('token')}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((response) => response.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,4 @@
|
|||||||
|
import { Airport } from "./airport";
|
||||||
|
import { Configuration } from "./configuration";
|
||||||
|
|
||||||
|
export { Airport, Configuration };
|
||||||
Reference in new issue
Block a user