Skip to content
Snippets Groups Projects
date.js 498 B
Newer Older
Sofiya Tepikin's avatar
Sofiya Tepikin committed
import { createSlice } from 'redux-starter-kit'
import { LocalDate } from 'js-joda'
Sofiya Tepikin's avatar
Sofiya Tepikin committed

const dateSlice = createSlice({
  slice: 'date',
  initialState: LocalDate.now().toString(),
Sofiya Tepikin's avatar
Sofiya Tepikin committed
  reducers: {
    setDate: (state, action) => action.payload
  }
})

// Extract the action creators object and the reducer
const { actions, reducer, selectors } = dateSlice
// Extract and export each action creator by name
export const { setDate } = actions

export const { getDate } = selectors

export default reducer