Skip to content

Commit e313493

Browse files
committed
Playing with Axios and API
1 parent df79100 commit e313493

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

resources/js/app.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ require("./bootstrap");
22

33
import { createApp } from "vue";
44

5-
import TestComponent from "./components/TestComponent.vue";
65
import NewComponent from "./components/NewComponent.vue";
76

87
createApp({
9-
components: { TestComponent, NewComponent },
8+
components: { NewComponent },
109
}).mount("#app");

resources/js/components/NewComponent.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<template>
2-
<div>Testing out New Vue 3 components <br />Greeting: {{ greeting }}</div>
3-
<div>Foo: {{ foo }}</div>
2+
<div>Testing out API</div>
43
</template>
54

65
<script>
76
export default {
8-
props: ["foo"],
7+
mounted() {
8+
axios
9+
.get("/api/products")
10+
.then((response) => {
11+
// commit('updateProducts', response.data);
12+
console.log("We got a response!");
13+
console.log(response.data);
14+
})
15+
.catch((error) => console.error(error));
16+
},
17+
// props: ["foo"],
918
setup() {
1019
const greeting = "Greetings";
1120
return { greeting };

resources/js/components/TestComponent.vue

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)