/
astafievk
/
source_code
Обзор
Документация
Войти
/
astafievk
/
source_code
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
App/src/api/slices/timeFormSlice.ts
67 строк
2 KB
astafievK
source code
21 июн 2024, 21:02
21 июн 2024, 21:02
37a1d03
Код
Авторство
О чём код?
import {createSlice} from "@reduxjs/toolkit" const currentDate = new Date(); interface ITimeFormSlice { idService: number, idEmployee: number nameEmployee: string nameService: string dateYear: number, dateMonth: number, dateDay: number dateHours: number dateMinutes: number } const timeFormSlice = createSlice({ name: 'timeForm', initialState: { dateYear: currentDate.getFullYear(), dateMonth: currentDate.getMonth() + 1, } as ITimeFormSlice, reducers: { setIdService: (state, action) => { state.idService = action.payload }, setIdEmployee: (state, action) => { state.idEmployee = action.payload }, setNameEmployee: (state, action) => { state.nameEmployee = action.payload }, setNameService: (state, action) => { state.nameService = action.payload }, setDateYear: (state, action) => { state.dateYear = action.payload }, setDateMonth: (state, action) => { state.dateMonth = action.payload }, setDateDay: (state, action) => { state.dateDay = action.payload }, setDateHours: (state, action) => { state.dateHours = action.payload }, setDateMinutes: (state, action) => { state.dateMinutes = action.payload }, } }) export const { setIdService, setIdEmployee, setNameEmployee, setNameService, setDateMinutes, setDateHours, setDateYear, setDateMonth, setDateDay, } = timeFormSlice.actions export default timeFormSlice.reducer