From 6ede39966bd41f13c4a53f07d10ff67f7cdfb001 Mon Sep 17 00:00:00 2001 From: Stedoss <29103029+Stedoss@users.noreply.github.com> Date: Sun, 30 Oct 2022 20:42:49 +0000 Subject: [PATCH] Start work on frontend dev --- frontend/leeds-beer-quest/src/lib/api.ts | 8 ++++++++ frontend/leeds-beer-quest/src/lib/environment.ts | 7 +++++++ frontend/leeds-beer-quest/src/pages/index.tsx | 8 ++++++++ 3 files changed, 23 insertions(+) create mode 100644 frontend/leeds-beer-quest/src/lib/api.ts create mode 100644 frontend/leeds-beer-quest/src/lib/environment.ts diff --git a/frontend/leeds-beer-quest/src/lib/api.ts b/frontend/leeds-beer-quest/src/lib/api.ts new file mode 100644 index 0000000..467baef --- /dev/null +++ b/frontend/leeds-beer-quest/src/lib/api.ts @@ -0,0 +1,8 @@ +export class API { + constructor(private baseAPIUrl: string) {} + + async getVenues() { + const response = await fetch(`${this.baseAPIUrl}/venue`); + await response.text(); + } +} \ No newline at end of file diff --git a/frontend/leeds-beer-quest/src/lib/environment.ts b/frontend/leeds-beer-quest/src/lib/environment.ts new file mode 100644 index 0000000..dd95633 --- /dev/null +++ b/frontend/leeds-beer-quest/src/lib/environment.ts @@ -0,0 +1,7 @@ +export type TEnvironment = { + BaseAPIUrl: string; +}; + +export const Environment: TEnvironment = { + BaseAPIUrl: "https://localhost:7021" +}; \ No newline at end of file diff --git a/frontend/leeds-beer-quest/src/pages/index.tsx b/frontend/leeds-beer-quest/src/pages/index.tsx index eeb4e5d..32c62ef 100644 --- a/frontend/leeds-beer-quest/src/pages/index.tsx +++ b/frontend/leeds-beer-quest/src/pages/index.tsx @@ -1,3 +1,11 @@ +import { API } from "../lib/api"; +import { Environment } from "../lib/environment"; + export function Index() { + const api = new API(Environment.BaseAPIUrl); + const a: any = ""; + api.getVenues().then((data) => { + console.log(data); + }).catch(_ => console.log("some error")); return(