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(
Hello, index!
); }; \ No newline at end of file