Skip to content

Commit 1ec126b

Browse files
[start 187584874] seller delete item
1 parent c2ef741 commit 1ec126b

File tree

5 files changed

+4
-62
lines changed

5 files changed

+4
-62
lines changed

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.scss

+1
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@
4343
@import "./assets/styles/liveChat.scss";
4444
@import "./assets//styles/UserProfile.scss";
4545
@import "./assets/styles/SellerSideProduct.scss";
46+
@import "./assets/styles/SellerDeleteItem.scss";
4647
@import "./assets/styles/SellerDeleteItem.scss"

src/pages/SellerDeleteItem.tsx

-34
This file was deleted.

src/store/features/product/productSlice.tsx

+1-26
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,6 @@ export const searchProduct = createAsyncThunk<IProduct, SearchCriteria>("product
3131
}
3232
);
3333

34-
export const deleteItem = createAsyncThunk<ISingleProduct, string>("product/deleteProduct", async(id, thunkApi)=>{
35-
try{
36-
const response = await productService.deleteItem(id)
37-
return response
38-
} catch(error){
39-
return thunkApi.rejectWithValue(error)
40-
}
41-
})
42-
4334
const productSlice = createSlice({
4435
name: "products",
4536
initialState,
@@ -78,23 +69,7 @@ const productSlice = createSlice({
7869
state.message = action.payload;
7970
state.isSuccess = false;
8071
})
81-
.addCase(deleteItem.pending, (state)=>{
82-
state.isLoading = true,
83-
state.isError = false,
84-
state.isSuccess = false
85-
})
86-
.addCase(deleteItem.fulfilled, (state, action: PayloadAction<ISingleProduct>)=>{
87-
state.isLoading = false,
88-
state.isError = false,
89-
state.products = state.products.filter(product => product.id !== action.payload.id),
90-
state.isSuccess = true
91-
})
92-
.addCase(deleteItem.rejected, (state, action: PayloadAction<any>)=>{
93-
state.isLoading = false,
94-
state.isError = true,
95-
state.products = action.payload,
96-
state.isSuccess = false
97-
});
72+
;
9873
}
9974
})
10075

src/utils/axios/axiosInstance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable */
22
import axios from "axios";
3-
export const URL = "https://e-commerce-ninjas-platform-backend.onrender.com";
3+
export const URL = "http://localhost:5001" //https://e-commerce-ninjas-platform-backend.onrender.com";
44
const axiosInstance = axios.create({
55
baseURL: `${URL}`,
66
headers: {

0 commit comments

Comments
 (0)