| | |
| | | |
| | | /////// CONSTANTS //////////////////////////////////////////////////////////////// |
| | | |
| | | export const apiBase = "/api" |
| | | export const iliasBase = "http://localhost:8060" |
| | | export const apiBase = import.meta.env.VITE_API_BASE |
| | | export const iliasBase = import.meta.env.VITE_ILIAS_BASE |
| | | export const routerBase = import.meta.env.VITE_ROUTER_BASE |
| | | |
| | | /////// KURS //////////////////////////////////////////////////////////////// |
| | | |
| | | export async function getKurse () { |
| | | let resKurs = await fetch(`${apiBase}/kurs?token=${apiToken.value}`) |
| | | return await resKurs.json() |
| | | } |
| | | |
| | | export async function getKurs (kursId) { |
| | | let resKurs = await fetch(`${apiBase}/kurs/${kursId}?token=${apiToken.value}`) |
| | |
| | | return await resKurs.json() |
| | | } |
| | | |
| | | /////// USER //////////////////////////////////////////////////////////////// |
| | | |
| | | export async function getUsers (offset, limit, search) { |
| | | const res = await fetch(`${apiBase}/users?offset=${offset}&limit=${limit}&search=${search}&token=${apiToken.value}`) |
| | | return res.json() |
| | | } |
| | | |
| | | export async function getUser (userId) { |
| | | const res = await fetch(`${apiBase}/user/userid/${userId}?token=${apiToken.value}`) |
| | | return await res.json() |
| | | } |
| | | |
| | | export async function getUserTeilnahmen (userId) { |
| | | const res = await fetch(`${apiBase}/user/teilnahmen/${userId}?token=${apiToken.value}`) |
| | | return await res.json() |
| | | } |
| | | |
| | | /////// SEARCH //////////////////////////////////////////////////////////////// |
| | | |
| | | export async function searchUsers (query) { |
| | | const res = await fetch(`${apiBase}/search/user?search=${query}&token=${apiToken.value}`) |
| | | return await res.json() |
| | | } |
| | | |