Skip to content

Commit

Permalink
add fetch product data in App.vue
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Nov 29, 2023
1 parent 57a06a3 commit 72b758f
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions ShoppingCart/Frondend/ecommerce-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,44 @@
<nav>
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link> |
<router-link to="/admin/category">Category</router-link> |
<router-link to="/admin/category">Category</router-link> |
<router-link to="/admin/category/add">Add</router-link> |
<router-link to="/admin/wishlist">Wishlist</router-link> |
<router-link to="/admin/product">Product</router-link>
</nav>
<router-view/>
<router-view />
</div>
</template>

<script>
import axios from "axios";
export default {
// components: {},
data() {
return {
baseURL: "http://localhost:9999/",
products: [],
categories: [],
};
},
methods: {
async fetchData() {
await axios
.get(this.baseURL + "category/")
.then((res) => {
this.categories = res.data;
})
.catch((err) => console.log("err : " + err));
},
},
mounted() {
this.fetchData;
},
};
</script>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
Expand Down

0 comments on commit 72b758f

Please sign in to comment.