Linking front for forum creation

This commit is contained in:
2024-04-09 17:27:26 +02:00
parent 5f483216b9
commit 61e269eb27
7 changed files with 50 additions and 19 deletions

View File

@ -5,21 +5,15 @@ import { restGet, restPost, restDelete, restPatch } from './restConsumer.js'
* List forums of a course
*/
export async function getForumsOfCourse(id){
ForumsOfCurrentCourse.value = [
{
id: 1,
name: "forum~1"
},
{
id: 2,
name: "forum~2"
},
]
// ForumsOfCurrentCourse = await restGet("/forums/" + id)
ForumsOfCurrentCourse.value = await restGet("/forums/" + id)
}
export const ForumsOfCurrentCourse = ref();
export function createForum(id, name){
restPost("/forums/" + id, {name: name}).then(_ => getForumsOfCourse(id));
}
/**
* List post of a specified forum
*/