mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-10-03 18:00:15 +02:00
chore: sanitize appUrl to remove trailing slash in updateConfigVariable function (#496)
This commit is contained in:
parent
9268e35141
commit
962ec27df4
@ -72,6 +72,10 @@ export default function AppShellDemo() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateConfigVariable = (configVariable: UpdateConfig) => {
|
const updateConfigVariable = (configVariable: UpdateConfig) => {
|
||||||
|
if (configVariable.key === 'general.appUrl') {
|
||||||
|
configVariable.value = sanitizeUrl(configVariable.value);
|
||||||
|
}
|
||||||
|
|
||||||
const index = updatedConfigVariables.findIndex(
|
const index = updatedConfigVariables.findIndex(
|
||||||
(item) => item.key === configVariable.key,
|
(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(() => {
|
useEffect(() => {
|
||||||
configService.getByCategory(categoryId).then((configVariables) => {
|
configService.getByCategory(categoryId).then((configVariables) => {
|
||||||
setConfigVariables(configVariables);
|
setConfigVariables(configVariables);
|
||||||
|
Loading…
Reference in New Issue
Block a user