Skip to content

Commit

Permalink
fix: insert new data
Browse files Browse the repository at this point in the history
  • Loading branch information
jouwdan committed Aug 5, 2023
1 parent 97b71db commit be3fbc0
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion apps/web/src/routes/(course-reader)/course/[courseid]/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,21 @@ export const load = async ({ params, parent }) => {
.eq('id', data.session.user.id);

if (!userCourseList || userCourseList.length === 0) {
// do something
await data.supabase.from('accessed_courses').insert([
{
id: data.session.user.id,
course_list: {
courses: [
{
id: course.id,
name: course.lo.title,
last_accessed: new Date().toISOString(),
visits: 1
}
]
}
}
]);
} else {
const courseList = userCourseList[0].course_list;

Expand Down

0 comments on commit be3fbc0

Please sign in to comment.