diff --git a/src/services/ApiService.ts b/src/services/ApiService.ts new file mode 100644 index 0000000..0844dd3 --- /dev/null +++ b/src/services/ApiService.ts @@ -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 }; + } +} diff --git a/src/services/ChannelService.ts b/src/services/ChannelService.ts deleted file mode 100644 index a1681f6..0000000 --- a/src/services/ChannelService.ts +++ /dev/null @@ -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; - } -}