remove unnecessary casts
This commit is contained in:
parent
428df339c4
commit
a09caf52d8
|
@ -19,10 +19,7 @@ export class ThemeStore extends BudiStore<ThemeState> {
|
||||||
|
|
||||||
syncAppTheme = (app: App) => {
|
syncAppTheme = (app: App) => {
|
||||||
this.update(state => {
|
this.update(state => {
|
||||||
const theme = ensureValidTheme(
|
const theme = ensureValidTheme(app.theme, DefaultAppTheme)
|
||||||
app.theme as Theme | undefined,
|
|
||||||
DefaultAppTheme
|
|
||||||
) as Theme
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
theme,
|
theme,
|
||||||
|
@ -35,10 +32,7 @@ export class ThemeStore extends BudiStore<ThemeState> {
|
||||||
const app = await API.saveAppMetadata(appId, { theme })
|
const app = await API.saveAppMetadata(appId, { theme })
|
||||||
this.update(state => ({
|
this.update(state => ({
|
||||||
...state,
|
...state,
|
||||||
theme: ensureValidTheme(
|
theme: ensureValidTheme(app.theme, DefaultAppTheme),
|
||||||
app.theme as Theme | undefined,
|
|
||||||
DefaultAppTheme
|
|
||||||
) as Theme,
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,10 +49,7 @@ export class ThemeStore extends BudiStore<ThemeState> {
|
||||||
const { theme, customTheme } = metadata
|
const { theme, customTheme } = metadata
|
||||||
this.update(state => ({
|
this.update(state => ({
|
||||||
...state,
|
...state,
|
||||||
theme: ensureValidTheme(
|
theme: ensureValidTheme(theme, DefaultAppTheme),
|
||||||
theme as Theme | undefined,
|
|
||||||
DefaultAppTheme
|
|
||||||
) as Theme,
|
|
||||||
customTheme: customTheme || {},
|
customTheme: customTheme || {},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { User, Document, Plugin, Snippet } from "../"
|
import { User, Document, Plugin, Snippet, Theme } from "../"
|
||||||
import { SocketSession } from "../../sdk"
|
import { SocketSession } from "../../sdk"
|
||||||
|
|
||||||
export type AppMetadataErrors = { [key: string]: string[] }
|
export type AppMetadataErrors = { [key: string]: string[] }
|
||||||
|
@ -14,7 +14,7 @@ export interface App extends Document {
|
||||||
instance: AppInstance
|
instance: AppInstance
|
||||||
tenantId: string
|
tenantId: string
|
||||||
status: string
|
status: string
|
||||||
theme?: string
|
theme?: Theme
|
||||||
customTheme?: AppCustomTheme
|
customTheme?: AppCustomTheme
|
||||||
revertableVersion?: string
|
revertableVersion?: string
|
||||||
lockedBy?: User
|
lockedBy?: User
|
||||||
|
|
Loading…
Reference in New Issue