[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()
store.dispatch(OptionsActions.save())
expect(fetch).toBeCalledWith(
'/options/save?_xsrf=undefined',
'./options/save?_xsrf=undefined',
{
credentials: "same-origin",
method: "POST"

View File

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