fix serverurl in openapi docs for self hosted instance (#4390)

* fix serverurl in openapi docs for self hosted instance

* fixed server url slash, moved calculation to enviroment function, fixed openapi path hardcoded api.twenty.com
This commit is contained in:
brendanlaschke
2024-03-13 12:13:45 +01:00
committed by GitHub
parent d8b370720c
commit f847b64fd1
8 changed files with 43 additions and 22 deletions

View File

@ -48,10 +48,13 @@ const TokenForm = ({
await submitToken(event.target.value);
};
const updateBaseUrl = (baseUrl) => {
setBaseUrl(baseUrl);
submitBaseUrl?.(baseUrl);
localStorage.setItem('baseUrl', JSON.stringify({ baseUrl: baseUrl }));
const updateBaseUrl = (baseUrl: string) => {
const url = baseUrl?.endsWith('/')
? baseUrl.substring(0, baseUrl.length - 1)
: baseUrl;
setBaseUrl(url);
submitBaseUrl?.(url);
localStorage.setItem('baseUrl', JSON.stringify({ baseUrl: url }));
};
const validateToken = (openApiJson) => {