mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-07 18:39:29 +00:00
refac, useApiClient for loader and actions
This commit is contained in:
@@ -1,23 +1,7 @@
|
||||
import defaultHeaders from '../../configuration/defaultHeaders';
|
||||
import getApiUrl from '../../configuration/getApiUrl';
|
||||
import getFetchCredentials from '../../configuration/getFetchCredentials';
|
||||
import isDevEnvironment from '../../functions/isDevEnvironment';
|
||||
import APIClient from '../../functions/APIClient';
|
||||
|
||||
const loadStatsPlaylist = async () => {
|
||||
const apiUrl = getApiUrl();
|
||||
|
||||
const response = await fetch(`${apiUrl}/api/stats/playlist/`, {
|
||||
headers: defaultHeaders,
|
||||
credentials: getFetchCredentials(),
|
||||
});
|
||||
|
||||
const notifications = await response.json();
|
||||
|
||||
if (isDevEnvironment()) {
|
||||
console.log('loadStatsPlaylist', notifications);
|
||||
}
|
||||
|
||||
return notifications;
|
||||
return APIClient('/api/stats/playlist/');
|
||||
};
|
||||
|
||||
export default loadStatsPlaylist;
|
||||
|
||||
Reference in New Issue
Block a user