service to fetch all
This commit is contained in:
parent
64a84708d0
commit
fba41717ad
2 changed files with 11 additions and 9 deletions
11
src/services/ApiService.ts
Normal file
11
src/services/ApiService.ts
Normal file
|
@ -0,0 +1,11 @@
|
|||
const API_URL = 'https://ts.cliffbreak.de/v1/';
|
||||
|
||||
export default class ApiService {
|
||||
public static async fetchAllChannels() {
|
||||
const channelRes = await fetch(API_URL + 'channels');
|
||||
const clientRes = await fetch(API_URL + 'clients');
|
||||
const channelJson = await channelRes.json();
|
||||
const clientJson = await clientRes.json();
|
||||
return { channelJson, clientJson };
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
const API_URL = 'https://ts.cliffbreak.de/v1/channels';
|
||||
|
||||
export default class ChannelService {
|
||||
public static async fetchAllChannels() {
|
||||
const response = await fetch(API_URL);
|
||||
const json = await response.json();
|
||||
return json;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue