/
astafievk
/
source_code
Обзор
Документация
Войти
/
astafievk
/
source_code
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
App/src/api/slices/editEmployeeModalSlice.ts
51 строка
1 KB
astafievK
source code
21 июн 2024, 21:02
21 июн 2024, 21:02
37a1d03
Код
Авторство
О чём код?
import { createSlice } from '@reduxjs/toolkit'; interface IEditEmployeeModalSlice { isOpen: boolean; idEmployee: number; name: string surname: string patronymic: string experience: number } const editEmployeeModalSlice = createSlice({ name: 'modalEditEmployee', initialState: { isOpen: false, } as IEditEmployeeModalSlice, reducers: { setIsOpen: (state, action) => { state.isOpen = action.payload; action.payload ? document.getElementById('body')!.classList.add('scroll-locked') : document.getElementById('body')!.classList.remove('scroll-locked') }, setEmployerId: (state, action) => { state.idEmployee = action.payload; }, setName: (state, action) => { state.name = action.payload; }, setSurname: (state, action) => { state.surname = action.payload; }, setPatronymic: (state, action) => { state.patronymic = action.payload; }, setExperience: (state, action) => { state.experience = action.payload; }, }, }); export const { setIsOpen, setEmployerId, setName, setPatronymic, setExperience, setSurname } = editEmployeeModalSlice.actions; export default editEmployeeModalSlice.reducer;