Skip to content

Commit

Permalink
fix: remove from cart toast and removed console logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirezaYousefpourM committed Nov 26, 2023
1 parent 67ca6ba commit 0fac008
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
1 change: 0 additions & 1 deletion frontend/src/Components/app-bar/AppBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export default function DrawerAppBar() {
</Link>
<Box sx={{ display: { xs: 'none', sm: 'block' } }}>
{appBarPaths.map((name, index) => {
console.log(shouldShowRoute(name) === false);
return (
shouldShowRoute(ROUTES[name]) && (
<Button
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/Signup/Signup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ const LoginForm = ({ onSignUpClick }) => {
// TODO: route to my-account page if it's successful
};

const {navigate} = useNavigate()
const { issueToken, issueTokenResponse } = useAPI();
const {
setAccessTokenFromLocalStorage
Expand All @@ -237,6 +238,7 @@ const LoginForm = ({ onSignUpClick }) => {

localStorage['user'] = JSON.stringify(issueTokenResponse.data);
setAccessTokenFromLocalStorage()

}, [issueTokenResponse]);

const handleClickOnForgotPass = () => {
Expand Down
13 changes: 4 additions & 9 deletions frontend/src/pages/my-account/useMyAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export default function useMyAccount() {

const toastDataTemp = {}
switch (removeFromCartResponse.status) {
case "200":
case 200:
toastDataTemp.message = "Item Removed Successfully"
toastDataTemp.alertType = "success"
break;
case "400":
case 400:
toastDataTemp.message = "Failed to Remove Item"
toastDataTemp.alertType = "error"
break;
Expand All @@ -57,14 +57,11 @@ export default function useMyAccount() {
break;
}

setRemoveFromCartResponse(null)
setToastData(toastDataTemp)
setOpenToast(true)
setWorkshopsData(null)
setPresentationsData(null)
getUserWorkshops()
getUserPresentations()
}, [removeFromCartResponse])
}, [getUserPresentations, getUserWorkshops, removeFromCartResponse, setPresentationsData, setRemoveFromCartResponse, setWorkshopsData])

useEffect(() => {
if (!accessToken)
Expand All @@ -74,7 +71,7 @@ export default function useMyAccount() {
getPresentationsData()
getUserWorkshops()
getUserPresentations()
}, [accessToken, getUserPresentations, getUserWorkshops])
}, [accessToken, getPresentationsData, getUserPresentations, getUserWorkshops, getWorkshopsData])

useEffect(() => {
if (!userPresentationsData
Expand All @@ -83,8 +80,6 @@ export default function useMyAccount() {
|| !presentationsData)
return

console.log("thing")

const userTempPresentations = []
const userTempWorkshops = []
const userTempCart = []
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/providers/APIProvider/APIProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ export function APIProvider({children}) {
break;
}

console.log(body)
const tokenStr = JSON.parse(localStorage.getItem('user'))['access']
await service.post(`${URL.baseURL}${URL.services.default}${endpoint}`,
body, {headers: {"Authorization": `Bearer ${tokenStr}`}})
Expand Down Expand Up @@ -304,7 +303,6 @@ export function APIProvider({children}) {


useEffect(() => {
console.log(refreshToken)
if (accessToken == null || refreshToken == null) {
return
}
Expand Down

0 comments on commit 0fac008

Please sign in to comment.