temp 3
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
|
||||
import type { User } from "../../types/user.type";
|
||||
import { Apis } from "../../apis";
|
||||
import type { CartItem } from "../../types/cart.type";
|
||||
|
||||
|
||||
interface UserState {
|
||||
data: User | null,
|
||||
loading: boolean;
|
||||
cart: CartItem[] | []
|
||||
}
|
||||
|
||||
const InitUserState: UserState = {
|
||||
data: null,
|
||||
loading: false
|
||||
loading: false,
|
||||
cart: []
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +21,9 @@ const userSlice = createSlice({
|
||||
name: "user",
|
||||
initialState: InitUserState,
|
||||
reducers: {
|
||||
|
||||
initCartData: (state, action) =>{
|
||||
state.cart = action.payload
|
||||
}
|
||||
},
|
||||
extraReducers: (bd) => {
|
||||
bd.addCase(fetchUserData.pending, (state, action) => {
|
||||
|
||||
Reference in New Issue
Block a user