move creation of all fetchers to fetcher.ts

This commit is contained in:
Pavel Mineev
2021-02-02 15:53:40 -06:00
committed by Umputun
parent 068eaea86a
commit 6d0b18f688
2 changed files with 3 additions and 5 deletions
+1 -4
View File
@@ -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`;
+2 -1
View File
@@ -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`);