1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-07-04 16:30:13 +02:00

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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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);