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