Improved theme update

This commit is contained in:
2018-11-23 16:05:48 +09:00
parent c6f9216367
commit 6052ffd1d5
2 changed files with 23 additions and 14 deletions

View File

@ -1,4 +1,5 @@
import AnimeNotifier from "../AnimeNotifier"
import { applyTheme } from "./Theme"
// Save new data from an input field
export async function save(arn: AnimeNotifier, input: HTMLElement) {
@ -38,8 +39,8 @@ export async function save(arn: AnimeNotifier, input: HTMLElement) {
// Update nickname based links on the page
return arn.reloadPage()
} else if(apiEndpoint.startsWith("/api/settings/") && input.dataset.field === "Theme") {
// Reload for the theme to take effect
location.reload()
// Apply theme instantly
applyTheme((input as HTMLInputElement).value)
} else {
return arn.reloadContent()
}