From 6d0b18f688ea7ed84e28954a115f6358ed089719 Mon Sep 17 00:00:00 2001 From: Pavel Mineev Date: Mon, 1 Feb 2021 00:57:45 +0300 Subject: [PATCH] move creation of all fetchers to fetcher.ts --- frontend/app/common/api.ts | 5 +---- frontend/app/common/fetcher.ts | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/frontend/app/common/api.ts b/frontend/app/common/api.ts index 35d010aa..05e92381 100644 --- a/frontend/app/common/api.ts +++ b/frontend/app/common/api.ts @@ -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`; diff --git a/frontend/app/common/fetcher.ts b/frontend/app/common/fetcher.ts index 0b9c3610..71bc9aca 100644 --- a/frontend/app/common/fetcher.ts +++ b/frontend/app/common/fetcher.ts @@ -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`);