This commit is contained in:
2021-04-27 18:24:01 +02:00
parent 616eeabab3
commit 33b099cd08
35 changed files with 1756 additions and 91 deletions

View File

@@ -0,0 +1,27 @@
import { IAppConfig } from "../../app-config";
import { ITelenorClient } from "./types";
export class TelenorClient implements ITelenorClient {
constructor(private appConfig: IAppConfig) {}
getAppointments = async () => {
const response = await fetch(
`${this.appConfig.telenorApiUrl}/api/Appointments`,
{
headers: {
accept: "application/json",
key: this.appConfig.telenorApiKey,
},
}
);
const json = await response.json();
const mapped = json.map((apt: any) => ({
...apt,
endTime: new Date(apt.endTime),
startTime: new Date(apt.startTime),
date: new Date(apt.date),
}));
return mapped;
};
}