mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-07-17 14:43:00 +08:00
28 lines
788 B
TypeScript
28 lines
788 B
TypeScript
import {CaseReducer, createAsyncThunk, createSlice, PayloadAction} from '@reduxjs/toolkit';
|
|
import {SubscribeResp} from 'src/utils/type';
|
|
import {getSubscribe} from 'src/api/config';
|
|
import {RootState} from '.';
|
|
const initialState: SubscribeResp = {}
|
|
|
|
const setSubs: CaseReducer<SubscribeResp, PayloadAction<SubscribeResp>> = (_, action) => {
|
|
return action.payload
|
|
}
|
|
|
|
export const updateGroupSubs = createAsyncThunk(
|
|
"groupConfig/update", getSubscribe
|
|
)
|
|
|
|
export const groupConfigSlice = createSlice({
|
|
name: "groupConfig",
|
|
initialState,
|
|
reducers: {
|
|
setSubs
|
|
},
|
|
extraReducers: (reducer) => {
|
|
reducer.addCase(updateGroupSubs.fulfilled, setSubs)
|
|
}
|
|
})
|
|
|
|
export const groupConfigSelector = (state: RootState) => state.groupConfig;
|
|
export default groupConfigSlice.reducer;
|