Skip to content

Commit

Permalink
add FE code comment
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Dec 6, 2023
1 parent 102b394 commit 276a053
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ShoppingCart/Frondend/ecommerce-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
v-if="!['Signup', 'Signin'].includes($route.name)"
/>
<div style="min-height: 60vh">
<!--
https://youtu.be/VZ1NV7EHGJw?si=FtsSuMndmHLiBwsc&t=710
delcare global variable via router view
-> so baseURL, categories are visible to ALL views
-->
<router-view
v-if="products && categories"
:baseURL="baseURL"
Expand Down Expand Up @@ -71,7 +77,25 @@ export default {
},
},
mounted() {
/**
* // NOTE!!! via this.fetchData() call, we can get products, categories
*
* when launch FE app (App.vue is imported to main.js as main FE entry point),
* so all other views (e.g. Product, EditProduct, Category, EditCategory...)
* can use products, categories directly via
*
* props: ["baseURL", "categories", "products"],
*
* this.categories
* this.products
*
* ..
*
* via above trick, we can simplify our code, and make logic more clear, simple
*/
this.token = localStorage.getItem("token");
console.log("this.token = " + this.token);
this.fetchData();
},
};
Expand Down

0 comments on commit 276a053

Please sign in to comment.