// /redux/slices/last20MessagesSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";

interface Last20MessagesSlice {
  last20Messages: string | null;
}

const initialState: Last20MessagesSlice = {
  last20Messages: null,
};

export const last20MessagesSlice = createSlice({
  name: "last20MessagesSlice",
  initialState,
  reducers: {
    setLast20Messages: (state, action: PayloadAction<string | null>) => {
      state.last20Messages = action.payload;
    },
  },
});

export const { setLast20Messages } = last20MessagesSlice.actions;
export default last20MessagesSlice.reducer;
