Start work on frontend dev
This commit is contained in:
parent
8cd07e2063
commit
6ede39966b
8
frontend/leeds-beer-quest/src/lib/api.ts
Normal file
8
frontend/leeds-beer-quest/src/lib/api.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export class API {
|
||||||
|
constructor(private baseAPIUrl: string) {}
|
||||||
|
|
||||||
|
async getVenues() {
|
||||||
|
const response = await fetch(`${this.baseAPIUrl}/venue`);
|
||||||
|
await response.text();
|
||||||
|
}
|
||||||
|
}
|
7
frontend/leeds-beer-quest/src/lib/environment.ts
Normal file
7
frontend/leeds-beer-quest/src/lib/environment.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export type TEnvironment = {
|
||||||
|
BaseAPIUrl: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Environment: TEnvironment = {
|
||||||
|
BaseAPIUrl: "https://localhost:7021"
|
||||||
|
};
|
@ -1,3 +1,11 @@
|
|||||||
|
import { API } from "../lib/api";
|
||||||
|
import { Environment } from "../lib/environment";
|
||||||
|
|
||||||
export function Index() {
|
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(<div>Hello, index!</div>);
|
return(<div>Hello, index!</div>);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user