mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
731 B
TypeScript
29 lines
731 B
TypeScript
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
|
|
export interface UIState {
|
|
panelWinUrls: string[];
|
|
}
|
|
|
|
const initialState: UIState = {
|
|
panelWinUrls: [],
|
|
};
|
|
|
|
const uiSlice = createSlice({
|
|
name: 'ui',
|
|
initialState,
|
|
reducers: {
|
|
addPanelWindowUrl(state, action: PayloadAction<{ url: string }>) {
|
|
const panelUrl = action.payload.url;
|
|
state.panelWinUrls.push(panelUrl);
|
|
},
|
|
deletePanelWindowUrl(state, action: PayloadAction<{ url: string }>) {
|
|
const panelUrl = action.payload.url;
|
|
const index = state.panelWinUrls.indexOf(panelUrl);
|
|
state.panelWinUrls.splice(index, 1);
|
|
},
|
|
},
|
|
});
|
|
|
|
export const uiActions = uiSlice.actions;
|
|
export const uiReducer = uiSlice.reducer;
|