blob: e430aad296a64bcd20bad9b6f9255acd4c2fe7b3 [file] [log] [blame]
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import type { RootState } from "./store";
// Define a type for the slice state
interface appState {
accountId: string;
}
// Define the initial state using that type
const initialState: appState = {
accountId: "",
};
export const appSlice = createSlice({
name: "app",
// `createSlice` will infer the state type from the `initialState` argument
initialState,
reducers: {
setAccountId: (state, action: PayloadAction<string>) => {
state.accountId = action.payload;
},
},
});
export const { setAccountId } = appSlice.actions;
// Other code such as selectors can use the imported `RootState` type
// export const selectCount = (state: RootState) => state.app.value;
export default appSlice.reducer;