[web] make it possible to run static viewer in subdirectories

This commit is contained in:
Maximilian Hils 2017-08-21 23:35:04 +02:00
parent 721f7cc92e
commit 58642d57f6
2 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,7 @@ describe('save', () => {
global.fetch = jest.fn() global.fetch = jest.fn()
store.dispatch(OptionsActions.save()) store.dispatch(OptionsActions.save())
expect(fetch).toBeCalledWith( expect(fetch).toBeCalledWith(
'/options/save?_xsrf=undefined', './options/save?_xsrf=undefined',
{ {
credentials: "same-origin", credentials: "same-origin",
method: "POST" method: "POST"

View File

@ -91,6 +91,9 @@ export function fetchApi(url, options={}) {
} else { } else {
url += '.json' url += '.json'
} }
if (url.startsWith("/")) {
url = "." + url;
}
return fetch(url, { return fetch(url, {
credentials: 'same-origin', credentials: 'same-origin',