move creation of all fetchers to fetcher.ts
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import { siteId, url } from './settings';
|
||||
import { BASE_URL, API_BASE } from './constants';
|
||||
import { Config, Comment, Tree, User, BlockedUser, Sorting, AuthProvider, BlockTTL, Image } from './types';
|
||||
import createFetcher, { apiFetcher } from './fetcher';
|
||||
|
||||
const authFetcher = createFetcher(`${BASE_URL}/auth`);
|
||||
const adminFetcher = createFetcher(`${BASE_URL}${API_BASE}/admin`);
|
||||
import { authFetcher, apiFetcher, adminFetcher } from './fetcher';
|
||||
|
||||
/* Auth methods */
|
||||
const FROM_URL = `${window.location.origin}${window.location.pathname}?selfClose`;
|
||||
|
||||
@@ -116,4 +116,5 @@ const createFetcher = (baseUrl: string = ''): Methods => {
|
||||
};
|
||||
|
||||
export const apiFetcher = createFetcher(`${BASE_URL}${API_BASE}`);
|
||||
export default createFetcher;
|
||||
export const authFetcher = createFetcher(`${BASE_URL}/auth`);
|
||||
export const adminFetcher = createFetcher(`${BASE_URL}${API_BASE}/admin`);
|
||||
|
||||
Reference in New Issue
Block a user