1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

player: refactored sagas

This commit is contained in:
Fedor Katurov 2021-03-03 11:17:54 +07:00
parent 5102c738b3
commit 7d4df40963
4 changed files with 29 additions and 20 deletions

View file

@ -1,11 +1,8 @@
import { IResultWithStatus, IEmbed } from '../types';
import { api, resultMiddleware, errorMiddleware } from '~/utils/api';
import { api, cleanResult } from '~/utils/api';
import { API } from '~/constants/api';
import { ApiGetEmbedYoutubeResult } from '~/redux/player/types';
export const getEmbedYoutube = (
ids: string[]
): Promise<IResultWithStatus<{ items: Record<string, IEmbed> }>> =>
export const getEmbedYoutube = (ids: string[]) =>
api
.get(API.EMBED.YOUTUBE, { params: { ids: ids.join(',') } })
.then(resultMiddleware)
.catch(errorMiddleware);
.get<ApiGetEmbedYoutubeResult>(API.EMBED.YOUTUBE, { params: { ids: ids.join(',') } })
.then(cleanResult);