2023-02-13 13:32:54 -05:00
|
|
|
import { createSlice, current } from '@reduxjs/toolkit';
|
2023-02-06 21:17:46 -05:00
|
|
|
|
|
|
|
|
const initialState = {
|
2023-02-08 10:49:38 -05:00
|
|
|
error: false,
|
2023-02-11 10:22:15 -05:00
|
|
|
title: 'ChatGPT Clone',
|
2023-02-06 21:17:46 -05:00
|
|
|
conversationId: null,
|
|
|
|
|
parentMessageId: null,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const currentSlice = createSlice({
|
|
|
|
|
name: 'convo',
|
|
|
|
|
initialState,
|
|
|
|
|
reducers: {
|
|
|
|
|
setConversation: (state, action) => {
|
2023-02-07 16:22:35 -05:00
|
|
|
return { ...state, ...action.payload };
|
2023-02-06 21:17:46 -05:00
|
|
|
},
|
2023-02-08 10:49:38 -05:00
|
|
|
setError: (state, action) => {
|
|
|
|
|
state.error = action.payload;
|
|
|
|
|
},
|
2023-02-06 21:17:46 -05:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-08 10:49:38 -05:00
|
|
|
export const { setConversation, setError } = currentSlice.actions;
|
2023-02-06 21:17:46 -05:00
|
|
|
|
|
|
|
|
export default currentSlice.reducer;
|