mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-05 00:39:28 +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 loadStatsVideo = async () => {
|
||||
const apiUrl = getApiUrl();
|
||||
|
||||
const response = await fetch(`${apiUrl}/api/stats/video/`, {
|
||||
headers: defaultHeaders,
|
||||
credentials: getFetchCredentials(),
|
||||
});
|
||||
|
||||
const notifications = await response.json();
|
||||
|
||||
if (isDevEnvironment()) {
|
||||
console.log('loadStatsVideo', notifications);
|
||||
}
|
||||
|
||||
return notifications;
|
||||
return APIClient('/api/stats/video/');
|
||||
};
|
||||
|
||||
export default loadStatsVideo;
|
||||
|
||||
Reference in New Issue
Block a user