import { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface ProfileData { firstName: string; lastName: string; email: string; dob: string; age: string; address: string; bankName: string; accountHolderName: string; accountNumber: string; routingNumber: string; phone:string; skype:string; city:string; state:string; country:string; paymentMethod:string; payoneerAccount:string; veemAccount:string; wiseEmail:string _id: string; } interface ProfileState { profile: ProfileData | null; loading: boolean; error: string | null; } const initialState: ProfileState = { profile: null, loading: false, error: null, }; const profileSlice = createSlice({ name: "profile", initialState, reducers: { setLoading: (state, action: PayloadAction) => { state.loading = action.payload; }, setProfile: (state, action: PayloadAction) => { state.profile = action.payload; state.error = null; }, setError: (state, action: PayloadAction) => { state.error = action.payload; }, clearProfile: (state) => { state.profile = null; state.error = null; state.loading = false; }, }, }); export const { setLoading, setProfile, setError, clearProfile } = profileSlice.actions; export default profileSlice.reducer;