mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-25 03:44:09 +01:00
adding redux in progress
This commit is contained in:
parent
85efaa4173
commit
7978ddd871
8 changed files with 97 additions and 62 deletions
|
|
@ -11,8 +11,10 @@ const currentSlice = createSlice({
|
|||
initialState,
|
||||
reducers: {
|
||||
setConversation: (state, action) => {
|
||||
const { payload } = action;
|
||||
state = { ...state, ...payload };
|
||||
console.log('in setConversation reducer');
|
||||
const { conversationId, parentMessageId } = action.payload;
|
||||
state.conversationId = conversationId;
|
||||
state.parentMessageId = parentMessageId;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { configureStore } from '@reduxjs/toolkit';
|
||||
|
||||
import convoReducer from './convoSlice.js';
|
||||
// import uploadReducer from './uploadSlice.js'
|
||||
import messageReducer from './messageSlice.js'
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
convo: convoReducer,
|
||||
// upload: uploadReducer,
|
||||
messages: messageReducer,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
20
store/messageSlice.js
Normal file
20
store/messageSlice.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = [];
|
||||
|
||||
const currentSlice = createSlice({
|
||||
name: 'messages',
|
||||
initialState,
|
||||
reducers: {
|
||||
setMessages: (state, action) => {
|
||||
console.log('in setMessages reducer');
|
||||
const { payload } = action;
|
||||
state = payload;
|
||||
},
|
||||
}
|
||||
});
|
||||
//
|
||||
|
||||
export const { setMessages } = currentSlice.actions;
|
||||
|
||||
export default currentSlice.reducer;
|
||||
Loading…
Add table
Add a link
Reference in a new issue