Commit 91902ce1 by CaIon

refactor: enhance SystemSetting submission logic and handle empty WorkerUrl

parent fdd349c9
......@@ -203,10 +203,13 @@ const SystemSetting = () => {
const submitWorker = async () => {
let WorkerUrl = removeTrailingSlash(inputs.WorkerUrl);
await updateOptions([
const options = [
{ key: 'WorkerUrl', value: WorkerUrl },
{ key: 'WorkerValidKey', value: inputs.WorkerValidKey },
]);
]
if (inputs.WorkerValidKey !== '' || WorkerUrl === '') {
options.push({ key: 'WorkerValidKey', value: inputs.WorkerValidKey });
}
await updateOptions(options);
};
const submitPayAddress = async () => {
......
......@@ -143,6 +143,7 @@ export function openPage(url) {
}
export function removeTrailingSlash(url) {
if (!url) return '';
if (url.endsWith('/')) {
return url.slice(0, -1);
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment