[WEB-5772] chore: theme switcher code refactor #8438
This commit is contained in:
parent
2bc7080d24
commit
d09c91b838
3 changed files with 3 additions and 9 deletions
|
|
@ -63,9 +63,7 @@ function ProfileAppearancePage() {
|
||||||
// Wait for the promise to resolve, then reload after showing toast
|
// Wait for the promise to resolve, then reload after showing toast
|
||||||
try {
|
try {
|
||||||
await updateCurrentUserThemePromise;
|
await updateCurrentUserThemePromise;
|
||||||
setTimeout(() => {
|
window.location.reload();
|
||||||
window.location.reload();
|
|
||||||
}, 1500);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Error toast already shown by setPromiseToast
|
// Error toast already shown by setPromiseToast
|
||||||
console.error("Error updating theme:", error);
|
console.error("Error updating theme:", error);
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,7 @@ export const ThemeSwitcher = observer(function ThemeSwitcher(props: {
|
||||||
});
|
});
|
||||||
// Wait for the promise to resolve, then reload after showing toast
|
// Wait for the promise to resolve, then reload after showing toast
|
||||||
await updatePromise;
|
await updatePromise;
|
||||||
setTimeout(() => {
|
window.location.reload();
|
||||||
window.location.reload();
|
|
||||||
}, 1500);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error updating theme:", error);
|
console.error("Error updating theme:", error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,7 @@ export const usePowerKPreferencesCommands = (): TPowerKCommandConfig[] => {
|
||||||
message: "Reloading to apply changes...",
|
message: "Reloading to apply changes...",
|
||||||
});
|
});
|
||||||
// reload the page after showing the toast
|
// reload the page after showing the toast
|
||||||
setTimeout(() => {
|
window.location.reload();
|
||||||
window.location.reload();
|
|
||||||
}, 1500);
|
|
||||||
return;
|
return;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue