Skip to content
Snippets Groups Projects
Commit b98980e8 authored by Jacopo Gasparetto's avatar Jacopo Gasparetto
Browse files

Add WIP APIService

parent 5c65eed6
No related branches found
No related tags found
No related merge requests found
class APIService {
static isTokenValid(): boolean {
return true;
}
static isAuthenticated = () => {
return this.isTokenValid();
}
static async get(input: RequestInfo | URL, init?: RequestInit | undefined): Promise<any> {
if (!APIService.isAuthenticated()) {
return Promise.reject(new Error("Your are not autenticated"));
}
const response = await fetch("/api/v1/" + input, init);
return JSON.parse(await response.json());
}
}
export default APIService;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment