paper-ai-release-24-07-21/app/store/slices/authSlice.ts

25 lines
521 B
TypeScript
Raw Normal View History

2024-01-21 23:08:25 +08:00
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
export interface APIState {
apiKey: string;
}
const initialState: APIState = {
apiKey: "",
};
export const authSlice = createSlice({
name: "auth",
initialState,
reducers: {
setApiKey: (state, action: PayloadAction<string>) => {
state.apiKey = action.payload;
},
},
});
// Action creators are generated for each case reducer function
export const { setApiKey } = authSlice.actions;
export const authReducer = authSlice.reducer;