mirror of
https://iceshrimp.dev/blueb/Chuckya-fe-standalone.git
synced 2026-01-11 13:33:21 -08:00
finish the merge
This commit is contained in:
parent
29f89db19d
commit
65f5a3cfb9
2 changed files with 9 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ import type { AxiosResponse, Method, RawAxiosRequestHeaders } from 'axios';
|
|||
import axios from 'axios';
|
||||
import LinkHeader from 'http-link-header';
|
||||
|
||||
import { getAccessToken } from './initial_state';
|
||||
import { getAccessToken, getBaseUrl } from './initial_state';
|
||||
import ready from './ready';
|
||||
|
||||
export const getLinks = (response: AxiosResponse) => {
|
||||
|
|
@ -39,11 +39,6 @@ const authorizationTokenFromInitialState = (): RawAxiosRequestHeaders => {
|
|||
};
|
||||
};
|
||||
|
||||
const baseUrlFromState = (getState?: GetState) => {
|
||||
const baseUrl = getState && getState().meta.get('base_url');
|
||||
return `${baseUrl}`;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function api(withAuthorization = true) {
|
||||
return axios.create({
|
||||
|
|
@ -52,7 +47,7 @@ export default function api(withAuthorization = true) {
|
|||
...(withAuthorization ? authorizationTokenFromInitialState() : {}),
|
||||
},
|
||||
|
||||
baseURL: baseUrlFromState(getState),
|
||||
baseURL: getBaseUrl(),
|
||||
|
||||
transformResponse: [
|
||||
function (data: unknown) {
|
||||
|
|
|
|||
|
|
@ -161,4 +161,11 @@ export function getAccessToken() {
|
|||
// Standalone-specific settings
|
||||
export const isSingleColumn = !forceSingleColumn && (initialState?.local_settings?.single_column ?? !hasMultiColumnPath);
|
||||
|
||||
/**
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
export function getBaseUrl() {
|
||||
return getMeta('base_url');
|
||||
}
|
||||
|
||||
export default initialState;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue