mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-15 01:14:27 -05:00
chore: sanitize appUrl to remove trailing slash in updateConfigVariable function (#496)
This commit is contained in:
parent
9268e35141
commit
962ec27df4
1 changed files with 8 additions and 0 deletions
|
@ -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…
Add table
Reference in a new issue