/
dedaMazai
/
TestServer
Обзор
Документация
Войти
/
dedaMazai
/
TestServer
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/features/addCommentForm/model/slices/addCommentFormSlice.ts
34 строки
1 KB
Andrey Chipizubov
fix
23 апр 2023, 17:32
23 апр 2023, 17:32
cc424e9
Код
Авторство
О чём код?
import { createSlice, PayloadAction } from '@reduxjs/toolkit'; import { AddCommentFormSchema } from '../types/addCommentForm'; const initialState: AddCommentFormSchema = { text: '', }; export const addCommentFormSlice = createSlice({ name: 'addCommentForm', initialState, reducers: { setText: (state, action: PayloadAction<string>) => { state.text = action.payload; }, }, // extraReducers: (builder) => { // builder // .addCase(loginByUsername.pending, (state) => { // state.error = undefined; // state.isLoading = true; // }) // .addCase(loginByUsername.fulfilled, (state) => { // state.isLoading = false; // }) // .addCase(loginByUsername.rejected, (state, action) => { // state.isLoading = false; // state.error = action.payload; // }); // }, }); // Action creators are generated for each case reducer function export const { actions: addCommentFormActions } = addCommentFormSlice; export const { reducer: addCommentFormReducer } = addCommentFormSlice;