Fix reverse proxy subpath support (#192)

This commit is contained in:
Thomas Miceli
2024-01-02 05:11:49 +01:00
parent f52310a841
commit 4cb7dc2d30
14 changed files with 69 additions and 32 deletions

View File

@ -8,13 +8,14 @@ document.addEventListener('DOMContentLoaded', () => {
});
const setSetting = (key: string, value: string) => {
const baseUrl = window.opengist_base_url || '';
const data = new URLSearchParams();
data.append('key', key);
data.append('value', value);
if (document.getElementsByName('_csrf').length !== 0) {
data.append('_csrf', ((document.getElementsByName('_csrf')[0] as HTMLInputElement).value));
}
return fetch('/admin-panel/set-config', {
return fetch(`${baseUrl}/admin-panel/set-config`, {
method: 'PUT',
credentials: 'same-origin',
body: data,