Skip to content

Commit

Permalink
fix: remove trailing slash characters in default base path to prevent…
Browse files Browse the repository at this point in the history
… CORS errors
  • Loading branch information
csm-thu committed Oct 22, 2021
1 parent 2ec563c commit c19e61c
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/services/config/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ import {
import { clientApi } from '../ClientApi';
import { DEFAULT_BASE_PATH } from '../../config/AppInstance';

// Remove trailing slash characters in default base path to prevent CORS errors
const defaultBasePath = DEFAULT_BASE_PATH.replace(/\/+$/, '');

export const Api = {
Scenarios: ScenarioApiFactory(null, DEFAULT_BASE_PATH, clientApi),
ScenarioRuns: ScenariorunApiFactory(null, DEFAULT_BASE_PATH, clientApi),
Solutions: SolutionApiFactory(null, DEFAULT_BASE_PATH, clientApi),
Datasets: DatasetApiFactory(null, DEFAULT_BASE_PATH, clientApi),
Workspaces: WorkspaceApiFactory(null, DEFAULT_BASE_PATH, clientApi),
Scenarios: ScenarioApiFactory(null, defaultBasePath, clientApi),
ScenarioRuns: ScenariorunApiFactory(null, defaultBasePath, clientApi),
Solutions: SolutionApiFactory(null, defaultBasePath, clientApi),
Datasets: DatasetApiFactory(null, defaultBasePath, clientApi),
Workspaces: WorkspaceApiFactory(null, defaultBasePath, clientApi),
};

0 comments on commit c19e61c

Please sign in to comment.