Skip to content

Commit

Permalink
Fixed auth
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsaturn committed Oct 19, 2024
1 parent 9f6c377 commit cd916c5
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/styles/theme/ThemeProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,39 @@ export class ThemeProvider {
return ThemeProvider.instance
}

private apiManager: ApiManager

constructor() {
this.apiManager = new ApiManager()
}

getCurrentTheme() {
const self = this
return Promise.resolve() //
.then(() => {
return self.apiManager.getCurrentTheme()
return new ApiManager().getCurrentTheme()
})
}

saveCurrentTheme(themeName: string) {
const self = this
return Promise.resolve() //
.then(() => {
return self.apiManager.setCurrentTheme(themeName)
return new ApiManager().setCurrentTheme(themeName)
})
}

saveCustomTheme(oldName: string, editModalTheme: CapRoverTheme) {
const self = this
return Promise.resolve().then(() => {
return self.apiManager.saveTheme(oldName, editModalTheme)
return new ApiManager().saveTheme(oldName, editModalTheme)
})
}

getAllThemes() {
const self = this
return Promise.resolve()
.then(() => {
return self.apiManager.getAllThemes()
return new ApiManager().getAllThemes()
})
.then((data) => {
return data.themes || ([] as CapRoverTheme[])
})
}

deleteTheme(themeName: string) {
const self = this
return Promise.resolve().then(() => {
return self.apiManager.deleteTheme(themeName)
return new ApiManager().deleteTheme(themeName)
})
}
}

0 comments on commit cd916c5

Please sign in to comment.