|
|
@@ -57,20 +57,26 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- course () {
|
|
|
- this.fetchNotices()
|
|
|
+ $route () {
|
|
|
+ this.init()
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
- getOneCourse({ courseId: this.$route.params.courseId })
|
|
|
- .then(res => {
|
|
|
- this.course = res
|
|
|
- this.fetchNotices()
|
|
|
- })
|
|
|
- .catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
- this.fetchNotices()
|
|
|
+ this.init()
|
|
|
},
|
|
|
methods: {
|
|
|
+ init() {
|
|
|
+ this.getCourse()
|
|
|
+ this.fetchNotices()
|
|
|
+ },
|
|
|
+ getCourse () {
|
|
|
+ getOneCourse({ courseId: this.$route.params.courseId })
|
|
|
+ .then(res => {
|
|
|
+ this.course = res
|
|
|
+ this.fetchNotices()
|
|
|
+ })
|
|
|
+ .catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
+ },
|
|
|
fetchNotices () {
|
|
|
getNotices({ courseId: this.course.id }).then(res => {
|
|
|
this.notices = res.data
|