-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from fdhhhdjd/release-#79
#79 Frontend product comment
- Loading branch information
Showing
52 changed files
with
2,533 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const API_CAROUSEL = { | ||
//* GET ALL CAROUSEL | ||
GET_ALL_CAROUSEL: "/api/carousel", | ||
}; | ||
export default API_CAROUSEL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const API_COMMENT = { | ||
//* CREATE COMMENT | ||
API_CREATE_COMMENT: "/api/review/create", | ||
|
||
//* UPDATE COMMENT | ||
API_UPDATE_COMMENT: "/api/review", | ||
|
||
//* DELETE COMMENT | ||
API_DELETE_COMMENT: "/api/review", | ||
}; | ||
export default API_COMMENT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const API_PRODUCT = { | ||
//* GET ALL PRODUCT | ||
GET_ALL_PRODUCT: "/api/product", | ||
|
||
//* GET DETAIL PRODUCT | ||
GET_DETAIL_PRODUCT: "/api/product/detail", | ||
}; | ||
export default API_PRODUCT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
frontend/src/v1/redux/carousel_slice.js/Api_Redux_Thunk_Carousel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { createAsyncThunk } from "@reduxjs/toolkit"; | ||
import axios from "axios"; | ||
import API_CAROUSEL from "../../configs/Apis/Carousel_Api/Api_Carousel"; | ||
|
||
export const Get_All_Carousel_Initial = createAsyncThunk( | ||
"Carousel/Get/All", | ||
async () => { | ||
try { | ||
const response = await axios.get(`${API_CAROUSEL.GET_ALL_CAROUSEL}`); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return error.response.data; | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
import { Get_All_Carousel_Initial } from "./Api_Redux_Thunk_Carousel"; | ||
const initialState = { | ||
loading: false, | ||
error: null, | ||
result_carousel: null, | ||
}; | ||
const Carousels = createSlice({ | ||
name: "carousels", | ||
initialState, | ||
reducers: { | ||
reset_carousel: (state) => { | ||
state.result_carousel = null; | ||
}, | ||
}, | ||
extraReducers: { | ||
//* Get All Carousel | ||
[Get_All_Carousel_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Get_All_Carousel_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.result_carousel = action.payload.element.carousels; | ||
}, | ||
[Get_All_Carousel_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
}, | ||
}); | ||
const Carousels_Slice = Carousels.reducer; | ||
export const { reset_carousel } = Carousels.actions; | ||
export default Carousels_Slice; |
82 changes: 82 additions & 0 deletions
82
frontend/src/v1/redux/comment_Slice/Api_Redux_Thunk_Comment.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { createAsyncThunk } from "@reduxjs/toolkit"; | ||
import axios from "axios"; | ||
import API_COMMENT from "../../configs/Apis/Comment_Api/Api_Comment"; | ||
|
||
export const Create_Comment_Initial = createAsyncThunk( | ||
"Comment/Create", | ||
async ({ id, rating, comment, accessToken }, { rejectWithValue }) => { | ||
const config = { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}; | ||
try { | ||
const response = await axios.post( | ||
`${API_COMMENT.API_CREATE_COMMENT}/${id}`, | ||
{ | ||
rating, | ||
comment, | ||
}, | ||
config | ||
); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
|
||
export const Update_Comment_Initial = createAsyncThunk( | ||
"Comment/Update", | ||
async ( | ||
{ productId, commentId, comment, accessToken }, | ||
{ rejectWithValue } | ||
) => { | ||
const config = { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}; | ||
try { | ||
const response = await axios.post( | ||
`${API_COMMENT.API_UPDATE_COMMENT}/${productId}/update/${commentId}`, | ||
{ | ||
comment, | ||
}, | ||
config | ||
); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); | ||
|
||
export const Delete_Comment_Initial = createAsyncThunk( | ||
"Comment/Delete", | ||
async ({ productId, commentId, accessToken }, { rejectWithValue }) => { | ||
const config = { | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}; | ||
try { | ||
const response = await axios.delete( | ||
`${API_COMMENT.API_DELETE_COMMENT}/${productId}/delete/${commentId}`, | ||
config | ||
); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return rejectWithValue(error.response.data); | ||
} | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
import { | ||
Create_Comment_Initial, | ||
Update_Comment_Initial, | ||
Delete_Comment_Initial, | ||
} from "./Api_Redux_Thunk_Comment"; | ||
const initialState = { | ||
loading: false, | ||
error: null, | ||
reviews: null, | ||
review_edit: null, | ||
}; | ||
const Comment_Product = createSlice({ | ||
name: "Comment", | ||
initialState, | ||
reducers: { | ||
reset_review: (state) => { | ||
state.reviews = null; | ||
state.review_edit = null; | ||
}, | ||
reset_review_error: (state) => { | ||
state.error = null; | ||
}, | ||
}, | ||
extraReducers: { | ||
//* Create Comment | ||
[Create_Comment_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Create_Comment_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.reviews = action.payload.element; | ||
}, | ||
[Create_Comment_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* Update Comment | ||
[Update_Comment_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Update_Comment_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.review_edit = action.payload.element; | ||
}, | ||
[Update_Comment_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
//* Delete Comment | ||
[Delete_Comment_Initial.pending]: (state, action) => { | ||
state.loading = true; | ||
}, | ||
[Delete_Comment_Initial.fulfilled]: (state, action) => { | ||
state.loading = false; | ||
state.reviews = action.payload.element; | ||
}, | ||
[Delete_Comment_Initial.rejected]: (state, action) => { | ||
state.loading = false; | ||
state.error = action.payload; | ||
}, | ||
}, | ||
}); | ||
const Comment_Slice = Comment_Product.reducer; | ||
export const { reset_review, reset_review_error } = Comment_Product.actions; | ||
export default Comment_Slice; |
35 changes: 35 additions & 0 deletions
35
frontend/src/v1/redux/product_slice/Api_Redux_Thunk_Products.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createAsyncThunk } from "@reduxjs/toolkit"; | ||
import axios from "axios"; | ||
import API_PRODUCT from "../../configs/Apis/Products_Api/Api_Product"; | ||
|
||
export const Get_All_Product_Initial = createAsyncThunk( | ||
"Product/Get/All", | ||
async () => { | ||
try { | ||
const response = await axios.get(`${API_PRODUCT.GET_ALL_PRODUCT}`); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return error.response.data; | ||
} | ||
} | ||
); | ||
|
||
export const Get_Detail_Product_Initial = createAsyncThunk( | ||
"Product/Get/Detail", | ||
async (id) => { | ||
try { | ||
const response = await axios.get( | ||
`${API_PRODUCT.GET_DETAIL_PRODUCT}/${id}` | ||
); | ||
return response.data; | ||
} catch (error) { | ||
if (!error.response) { | ||
throw error; | ||
} | ||
return error.response.data; | ||
} | ||
} | ||
); |
Oops, something went wrong.
d4eb1db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
serversendemailshopshoes – ./server_send_email
serversendemailshopshoes-fdhhhdjd.vercel.app
full-stack-shop-shoes-bootstrap.vercel.app
serversendemailshopshoes-git-main-fdhhhdjd.vercel.app
d4eb1db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
full-stack-shop-shoes – ./
full-stack-shop-shoes.vercel.app
full-stack-shop-shoes-git-main-fdhhhdjd.vercel.app
full-stack-shop-shoes-fdhhhdjd.vercel.app
shopshoes.cf