service to fetch all

This commit is contained in:
Niel 2019-04-18 01:07:08 +02:00
parent 64a84708d0
commit fba41717ad
2 changed files with 11 additions and 9 deletions

View 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 };
}
}

View file

@ -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;
}
}