at the end of the day, it was inevitable
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import * as api from '../../../../../api/themesApi'
|
||||
import ReduxModule from '../../../abstract/reduxModule'
|
||||
|
||||
const GET_DEFAULT_THEME = 'Get default theme'
|
||||
|
||||
export class Themes extends ReduxModule {
|
||||
|
||||
getNamespace () {
|
||||
return '[Themes]'
|
||||
}
|
||||
|
||||
getDefaultTheme = ({token, fulfilled}) => {
|
||||
return api
|
||||
.getDefaultItem(token)
|
||||
.then((data) => {
|
||||
fulfilled(data)
|
||||
return data
|
||||
})
|
||||
};
|
||||
|
||||
defineActions () {
|
||||
const getDefaultTheme = this.thunkAction(GET_DEFAULT_THEME, this.getDefaultTheme)
|
||||
return {
|
||||
getDefaultTheme
|
||||
}
|
||||
}
|
||||
|
||||
getInitialState () {
|
||||
return {
|
||||
isPending: false,
|
||||
themes: [],
|
||||
defaultTheme: null,
|
||||
activeId: ''
|
||||
}
|
||||
}
|
||||
|
||||
defineReducers () {
|
||||
return {
|
||||
[`${GET_DEFAULT_THEME} fulfilled`]: this.setReducer('defaultTheme')
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const themes = new Themes()
|
||||
themes.init()
|
||||
export default themes
|
||||
|
||||
export const getDefaultTheme = themes.actions.getDefaultTheme
|
||||
Reference in New Issue
Block a user