chore: sanitize appUrl to remove trailing slash in updateConfigVariable function (#496)

This commit is contained in:
Cabeza
2024-06-10 05:01:08 -04:00
committed by GitHub
parent 9268e35141
commit 962ec27df4

View File

@@ -72,6 +72,10 @@ export default function AppShellDemo() {
};
const updateConfigVariable = (configVariable: UpdateConfig) => {
if (configVariable.key === 'general.appUrl') {
configVariable.value = sanitizeUrl(configVariable.value);
}
const index = updatedConfigVariables.findIndex(
(item) => item.key === configVariable.key,
);
@@ -86,6 +90,10 @@ export default function AppShellDemo() {
}
};
const sanitizeUrl = (url: string): string => {
return url.endsWith('/') ? url.slice(0, -1) : url;
};
useEffect(() => {
configService.getByCategory(categoryId).then((configVariables) => {
setConfigVariables(configVariables);