Skip to content

Commit 4445ba9

Browse files
committed
Add AJAX call sample using axios
1 parent 43a7dd6 commit 4445ba9

File tree

1 file changed

+9
-8
lines changed
  • src/VueJsTypeScriptAspNetCoreSample/src/components

1 file changed

+9
-8
lines changed
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import * as Vue from "vue";
22
import Component from "vue-class-component";
3+
import axios from "axios";
34

45
@Component({
56
name: "Hello",
67
})
78
export default class Hello extends Vue {
89
msg: string = "Welcome to Your Vue.js App";
9-
// created (): void {
10-
// axios
11-
// .get('/api/hello')
12-
// .then((res) => {
13-
// this.msg = res.data.message
14-
// })
15-
// .catch((ex) => console.log(ex))
16-
// }
10+
created (): void {
11+
axios
12+
.get("/api/hello")
13+
.then((res) => {
14+
this.msg = res.data.message;
15+
})
16+
.catch((ex) => console.log(ex))
17+
}
1718
}

0 commit comments

Comments
 (0)