refactor: replace 'let' with 'const' for better variable scoping and immutability
This commit is contained in:
@@ -217,20 +217,19 @@ export async function getProxies(): Promise<{
|
||||
}, []);
|
||||
|
||||
if (global?.all) {
|
||||
let globalGroups: IProxyGroupItem[] = global.all.reduce<IProxyGroupItem[]>(
|
||||
(acc, name) => {
|
||||
if (proxyRecord[name]?.all) {
|
||||
acc.push({
|
||||
...proxyRecord[name],
|
||||
all: proxyRecord[name].all!.map((item) => generateItem(item)),
|
||||
});
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
[],
|
||||
);
|
||||
const globalGroups: IProxyGroupItem[] = global.all.reduce<
|
||||
IProxyGroupItem[]
|
||||
>((acc, name) => {
|
||||
if (proxyRecord[name]?.all) {
|
||||
acc.push({
|
||||
...proxyRecord[name],
|
||||
all: proxyRecord[name].all!.map((item) => generateItem(item)),
|
||||
});
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
let globalNames = new Set(globalGroups.map((each) => each.name));
|
||||
const globalNames = new Set(globalGroups.map((each) => each.name));
|
||||
groups = groups
|
||||
.filter((group) => {
|
||||
return !globalNames.has(group.name);
|
||||
@@ -674,7 +673,7 @@ export async function saveWebdavConfig(
|
||||
}
|
||||
|
||||
export async function listWebDavBackup() {
|
||||
let list: IWebDavFile[] = await invoke<IWebDavFile[]>("list_webdav_backup");
|
||||
const list: IWebDavFile[] = await invoke<IWebDavFile[]>("list_webdav_backup");
|
||||
list.map((item) => {
|
||||
item.filename = item.href.split("/").pop() as string;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user