move some parts to services and introduce the backend communication for the airports

This commit is contained in:
Sven Czarnian
2022-11-03 23:36:21 +01:00
parent 914048fadf
commit 5c9352c362
4 changed files with 20 additions and 1 deletions

15
src/services/airport.ts Normal file
View File

@@ -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);
}
}