mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-12 22:26:08 -04:00

We discussed whether the minor-version is relevant for the API base-path and came to the conclusion, that it's not really needed as breaking API changes need a new major version anyway. This commit also removes the trailing slash from the URL which is returned by `getBackendUrl`. This is needed as we composed the API routes in our implementation always with a starting slash thus leading to double slashes. Example of old behaviour: getBackendUrl() + '/config' => example.com/api/v2.0//config Example of new behaviuor: getBackendUrl() + '/config' => example.com/api/v2/config
14 lines
465 B
TypeScript
14 lines
465 B
TypeScript
import { FrontendConfig } from '../../api/frontend-config/types'
|
|
import { store } from '../../utils/store'
|
|
import { FrontendConfigActionType, SetFrontendConfigAction } from './types'
|
|
|
|
export const setFrontendConfig = (state: FrontendConfig): void => {
|
|
const action: SetFrontendConfigAction = {
|
|
type: FrontendConfigActionType.SET_FRONTEND_CONFIG,
|
|
state: {
|
|
...state,
|
|
backendUrl: state.backendUrl + '/api/v2'
|
|
}
|
|
}
|
|
store.dispatch(action)
|
|
}
|