REST Service for POPCORN - ILIAS
alex
2025-06-03 fc8d4b3a59bd6a6ccfda41a2142d5ca2c414e509
adding page Courses.vue
1 files added
2 files modified
88 ■■■■■ changed files
vue/src/pages/Courses.vue 80 ●●●●● patch | view | raw | blame | history
vue/src/pages/Users.vue 6 ●●●●● patch | view | raw | blame | history
vue/src/router.js 2 ●●●●● patch | view | raw | blame | history
vue/src/pages/Courses.vue
New file
@@ -0,0 +1,80 @@
<script setup>
import {onMounted, reactive, ref} from "vue"
import {useRoute} from "vue-router"
import Pagination from "../components/Pagination.vue"
const route = useRoute()
const kurse = ref([])
const error = ref(null)
onMounted(init)
/////////////////////////////////////////////////////////////////////////
async function init (offset = 0) {
   const res = await fetch(`/api/kurs?token=jiuGfr432898D90290kjfsldkfn3hh8F`)
   const data = await res.json()
   console.log(data)
   if (res.status === 200) {
      kurse.value = data
   }
   else {
      error.value = `ERROR: ${res.status}`
   }
}
function go (offset) {
   console.log("go", offset)
   return init(offset)
}
</script>
<template>
   <div>
      <h1>
         ILIAS Kurse
<!--         <small>{{users.offset}} - {{users.offset+users.data.length}} von {{users.total}}</small>-->
      </h1>
      <p v-if="error">{{ error }}</p>
      <div class="kurse">
         <table class="w100p" v-if="kurse">
            <thead>
               <tr>
                  <th>usr_id</th>
                  <th>obj_id</th>
                  <th>title</th>
                  <th>description</th>
                  <th>type</th>
               </tr>
            </thead>
            <tbody>
               <tr v-for="kurs in kurse">
                  <td>
                     <RouterLink :to="`/ui/user/${kurs.usr_id}`">
                        {{kurs.ref_id}}
                     </RouterLink>
                  </td>
                  <td>{{kurs.obj_id}}</td>
                  <td>{{kurs.title}}</td>
                  <td>{{kurs.description}}</td>
                  <td>{{kurs.type}}</td>
               </tr>
            </tbody>
         </table>
      </div>
<!--      <pre>{{ kurse }}</pre>-->
   </div>
</template>
<style scoped>
</style>
vue/src/pages/Users.vue
@@ -43,10 +43,8 @@
   <div>
      <h1>
         Users
         <small>
            {{users.offset}} - {{users.offset+users.data.length}} von {{users.total}}
         </small>
         ILIAS Users
<!--         <small>{{users.offset}} - {{users.offset+users.data.length}} von {{users.total}}</small>-->
      </h1>
      <p>{{ userId }}</p>
      <p v-if="error">{{ error }}</p>
vue/src/router.js
@@ -5,11 +5,13 @@
import Users from './pages/Users.vue'
import UserDetail from './pages/UserDetail.vue'
import Courses from './pages/Courses.vue'
const routes = [
   { path: '/', redirect: "/user" },
   { path: '/ui/user', component: Users },
   { path: '/ui/user/:userId', component: UserDetail },
   { path: '/ui/course', component: Courses },
]
const router = createRouter({