File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -12,5 +12,8 @@ const apiClient = axios.create({
12
12
export default {
13
13
getEvents ( ) {
14
14
return apiClient . get ( '/events' )
15
+ } ,
16
+ getEvent ( id ) {
17
+ return apiClient . get ( '/events/' + id )
15
18
}
16
19
}
Original file line number Diff line number Diff line change 1
1
<template >
2
- <h1 >Showing event # {{ id }}</h1 >
2
+ <h1 >Showing event {{ event.title }}</h1 >
3
3
</template >
4
4
<script >
5
+ import EventService from ' @/services/EventService.js'
6
+
5
7
export default {
6
- props: [' id' ]
8
+ props: [' id' ],
9
+ data () {
10
+ return {
11
+ event : []
12
+ }
13
+ },
14
+ mounted () {
15
+ EventService .getEvent (this .id )
16
+ .then (response => {
17
+ this .event = response .data
18
+ })
19
+ .catch (error => {
20
+ console .log (' There was an error:' , error .response )
21
+ })
22
+ }
7
23
}
8
24
</script >
You can’t perform that action at this time.
0 commit comments