-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c9f1e51
commit 90cf940
Showing
4 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ const tables = [ | |
{ | ||
id: 1, | ||
title: "user", | ||
name: "name", | ||
}, | ||
{ | ||
id: 2, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { configureStore, MiddlewareArray } from "@reduxjs/toolkit"; | ||
import logger from "./loggerMiddleware"; | ||
import { tableSlice } from "./tableSlice"; | ||
|
||
export const store = configureStore({ | ||
reducer: {}, | ||
reducer: { | ||
table: tableSlice.reducer, | ||
}, | ||
middleware: new MiddlewareArray().concat(logger), | ||
devTools: process.env.NODE_ENV !== "production", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-disable no-param-reassign */ | ||
import { createSlice, PayloadAction, createAsyncThunk } from "@reduxjs/toolkit"; | ||
import axios from "../common/axios"; | ||
|
||
const name = "table"; | ||
|
||
const initialState = { | ||
isAddClick: false, | ||
tables: [], | ||
}; | ||
|
||
export const tableSlice = createSlice({ | ||
name, | ||
initialState, | ||
reducers: { | ||
getTables: (state, action) => { | ||
state.tables = [...action.payload]; | ||
}, | ||
add: (state, action) => { | ||
state.isAddClick = action.payload; // 상태 변경 예시 1 | ||
}, | ||
}, | ||
extraReducers: {}, | ||
}); | ||
|
||
export const { getTables, add } = tableSlice.actions; |