You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.1 KiB
54 lines
1.1 KiB
<template>
|
|
<div class="grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 mt-2">
|
|
{{ status }}
|
|
<CourseCardList
|
|
:courses="courses"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import CourseCardList from './CourseCardList.vue';
|
|
import {ENTRYPOINT} from '../../../config/entrypoint';
|
|
import axios from "axios";
|
|
|
|
export default {
|
|
name: 'CourseList',
|
|
components: {
|
|
CourseCardList,
|
|
},
|
|
data() {
|
|
return {
|
|
status: '',
|
|
courses: [],
|
|
layout: 'list',
|
|
sortKey: null,
|
|
sortOrder: null,
|
|
sortField: null,
|
|
};
|
|
},
|
|
created: function () {
|
|
this.load();
|
|
},
|
|
mounted: function () {
|
|
},
|
|
methods: {
|
|
load: function () {
|
|
this.status = 'Loading';
|
|
let user = this.$store.getters['security/getUser'];
|
|
if (user) {
|
|
axios.get(ENTRYPOINT + 'users/' + user.id + '/courses.json').then(response => {
|
|
this.status = '';
|
|
if (Array.isArray(response.data)) {
|
|
this.courses = response.data;
|
|
}
|
|
}).catch(function (error) {
|
|
console.log(error);
|
|
});
|
|
} else {
|
|
this.status = '';
|
|
}
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
|