diff --git a/src/mixins.ts b/src/mixins.ts index b759ddf..20fc55e 100644 --- a/src/mixins.ts +++ b/src/mixins.ts @@ -98,24 +98,22 @@ export function getTimeFromQuery(query: string) { * @returns the streamers in that list that are online */ export async function followersStreaming(streamers: string[]): Promise { - const payload = { - streamers: streamers - } - // do not make request if no followers if (streamers.length == 0) { return [] } - const data: StreamerData[] = await postEndpoint('api/users/followingStreamer/bulk', payload) - - const liveStreamers: string[] = [] - - for (const streamer of data) { - if (streamer.isLive) { - liveStreamers.push(streamer.login) - } + let data: string[] = [] + const payload = { + streamers } - return liveStreamers + await postEndpoint('api/users/isLive/bulk', payload) + .then((res: string[]) => { + data = res + }) + + + + return data } diff --git a/src/views/HomepageView.vue b/src/views/HomepageView.vue index 9e3ac97..6aee67b 100644 --- a/src/views/HomepageView.vue +++ b/src/views/HomepageView.vue @@ -71,8 +71,6 @@ export default { async mounted() { window.onscroll = this.getNextCategory - this.following = await followersStreaming(getFollows()) - // get discover page await getEndpoint('api/discover') .catch(() => { @@ -81,6 +79,8 @@ export default { .then((data: CategoryPreviewInterface[]) => { this.data = data }) + + this.following = await followersStreaming(getFollows()) }, components: { StreamPreviewVue, @@ -96,10 +96,10 @@ export default {
-
+

Following

Streamers you follow

-
    +