mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-12 20:44:24 +01:00
feat: search bar working, still in progress
This commit is contained in:
parent
610cba4a60
commit
0f54ffd8b4
10 changed files with 147 additions and 24 deletions
|
|
@ -1,11 +1,12 @@
|
|||
import { configureStore } from '@reduxjs/toolkit';
|
||||
|
||||
import convoReducer from './convoSlice.js';
|
||||
import messageReducer from './messageSlice.js'
|
||||
import modelReducer from './modelSlice.js'
|
||||
import submitReducer from './submitSlice.js'
|
||||
import textReducer from './textSlice.js'
|
||||
import userReducer from './userReducer.js'
|
||||
import messageReducer from './messageSlice.js';
|
||||
import modelReducer from './modelSlice.js';
|
||||
import submitReducer from './submitSlice.js';
|
||||
import textReducer from './textSlice.js';
|
||||
import userReducer from './userReducer.js';
|
||||
import searchReducer from './searchSlice.js';
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
|
|
@ -15,6 +16,7 @@ export const store = configureStore({
|
|||
text: textReducer,
|
||||
submit: submitReducer,
|
||||
user: userReducer,
|
||||
search: searchReducer
|
||||
},
|
||||
devTools: true,
|
||||
});
|
||||
devTools: true
|
||||
});
|
||||
|
|
|
|||
30
client/src/store/searchSlice.js
Normal file
30
client/src/store/searchSlice.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const initialState = {
|
||||
search: false,
|
||||
query: '',
|
||||
};
|
||||
|
||||
const currentSlice = createSlice({
|
||||
name: 'search',
|
||||
initialState,
|
||||
reducers: {
|
||||
setSearchState: (state, action) => {
|
||||
state.search = action.payload;
|
||||
},
|
||||
setQuery: (state, action) => {
|
||||
const q = action.payload;
|
||||
state.query = q;
|
||||
|
||||
if (!q || q === '') {
|
||||
state.search = false;
|
||||
} else {
|
||||
state.search = true;
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
export const { setSearchState, setQuery } = currentSlice.actions;
|
||||
|
||||
export default currentSlice.reducer;
|
||||
Loading…
Add table
Add a link
Reference in a new issue