Force reload of custom css if it's updated (#1073)

This commit is contained in:
InfiniteTF
2021-01-29 05:00:47 +01:00
committed by GitHub
parent 0d7663c13d
commit 203fc3e4b2
2 changed files with 13 additions and 0 deletions

View File

@@ -60,10 +60,22 @@ export const SettingsInterfacePanel: React.FC = () => {
}, [config]);
async function onSave() {
const prevCSS = config?.configuration.interface.css;
const prevCSSenabled = config?.configuration.interface.cssEnabled;
try {
const result = await updateInterfaceConfig();
// eslint-disable-next-line no-console
console.log(result);
// Force refetch of custom css if it was changed
if (
prevCSS !== result.data?.configureInterface.css ||
prevCSSenabled !== result.data?.configureInterface.cssEnabled
) {
await fetch("/css", { cache: "reload" });
window.location.reload();
}
Toast.success({ content: "Updated config" });
} catch (e) {
Toast.error(e);