import { ITheme } from './theme.interface' ; interface IThemeStorage { id : string ; theme : ITheme ; } export class ThemeStore { private themes : Array < IThemeStorage > = [ ] ; private defaultTheme ? : ITheme ; async addTheme ( id , theme ) { this . themes . push ( { id , theme , } ) ; return await this . getThemeById ( id ) ; } async getThemeById ( id ) { return this . themes . find ( ( theme ) => theme . id === id ) ?. theme ; } async setDefaultTheme ( themeId ) { this . defaultTheme = await this . getThemeById ( themeId ) ; } async getDefaultTheme ( ) { return this . defaultTheme ; } }