Skip to content

Commit

Permalink
Add admin page into protected routes
Browse files Browse the repository at this point in the history
  • Loading branch information
ckng0221 committed Feb 2, 2024
1 parent 4e64ffc commit f1c3bf8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions apps/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ function App() {
}
/>
<Route path="about" element={<About />} />

<Route
path="checkout"
element={
Expand All @@ -163,7 +162,6 @@ function App() {
/>
}
/>

{/* Private */}
<Route element={<ProtectedRoute isAllowed={!!customer._id} />}>
<Route path="account" element={<Account customer={customer} />} />
Expand All @@ -175,8 +173,8 @@ function App() {
path="borrowings/:borrowingId"
element={<BorrowingDetails />}
/>
<Route path="admin" element={<Admin />} />
</Route>
<Route path="admin" element={<Admin />} />
</Route>
</Routes>
</BrowserRouter>
Expand Down
2 changes: 1 addition & 1 deletion apps/ui/src/pages/BookDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function BookDetails(props: IProps) {
navigate(`/login?redirectTo=${prevLocation.pathname}`);
}
const cart = props.cartItems.find((item) => item.book_id === bookId);
console.log(cart);
// console.log(cart);

if (cart?._id) {
cart.quantity++;
Expand Down
4 changes: 2 additions & 2 deletions apps/ui/src/pages/Checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function Checkout(props: IProps) {
// console.log('payment_initial', payment);
// console.log('payments', payments);

await sleep(1000);
// await sleep(1000);
// console.log('lala', props.cartItems);

props.cartItems.map((cart) => {
Expand All @@ -167,7 +167,7 @@ function Checkout(props: IProps) {
if (!cart._id) return;
deleteCartById(cart?._id);
});
props.setCartItems([]);
props.setCartItems(() => []);
//delete cart in db
setShowLoading(false);
setShow(false);
Expand Down

0 comments on commit f1c3bf8

Please sign in to comment.