-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tyler Ohlsen <[email protected]>
- Loading branch information
Showing
6 changed files
with
77 additions
and
4 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
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,7 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * from './store'; | ||
export * from './reducers'; |
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,6 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export * from './workspace_reducer'; |
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,31 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { createSlice } from '@reduxjs/toolkit'; | ||
|
||
const initialState = { | ||
isDirty: false, | ||
components: [], | ||
}; | ||
|
||
const workspaceSlice = createSlice({ | ||
name: 'workspace', | ||
initialState, | ||
reducers: { | ||
setDirty(state) { | ||
state.isDirty = true; | ||
}, | ||
removeDirty(state) { | ||
state.isDirty = false; | ||
}, | ||
setComponents(state, action) { | ||
state.components = action.payload; | ||
state.isDirty = true; | ||
}, | ||
}, | ||
}); | ||
|
||
export const workspaceReducer = workspaceSlice.reducer; | ||
export const { setDirty, removeDirty, setComponents } = workspaceSlice.actions; |
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,17 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configureStore } from '@reduxjs/toolkit'; | ||
import { combineReducers } from 'redux'; | ||
import { workspaceReducer } from './reducers'; | ||
|
||
const rootReducer = combineReducers({ | ||
workspace: workspaceReducer, | ||
}); | ||
export const store = configureStore({ | ||
reducer: rootReducer, | ||
}); | ||
|
||
export type AppState = ReturnType<typeof rootReducer>; |