|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
<template> |
|
|
|
|
<StickyCourses/> |
|
|
|
|
<SessionTabs/> |
|
|
|
|
<SessionListWrapper :sessions="sessions"/> |
|
|
|
|
</template> |
|
|
|
@ -10,12 +11,14 @@ import {useStore} from 'vuex'; |
|
|
|
|
import {useQuery, useResult} from '@vue/apollo-composable' |
|
|
|
|
import {GET_SESSION_REL_USER} from "../../../graphql/queries/SessionRelUser.js"; |
|
|
|
|
import {DateTime} from "luxon"; |
|
|
|
|
import SessionTabs from './Tabs'; |
|
|
|
|
import SessionListWrapper from './SessionListWrapper'; |
|
|
|
|
import SessionTabs from '../../../components/session/Tabs'; |
|
|
|
|
import SessionListWrapper from '../../../components/session/SessionListWrapper'; |
|
|
|
|
import StickyCourses from '../../../views/user/courses/StickyCourses.vue'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
name: 'SessionList', |
|
|
|
|
components: { |
|
|
|
|
StickyCourses, |
|
|
|
|
SessionTabs, |
|
|
|
|
SessionListWrapper |
|
|
|
|
}, |
|
|
|
@ -25,17 +28,16 @@ export default { |
|
|
|
|
|
|
|
|
|
if (user.value) { |
|
|
|
|
let userId = user.value.id; |
|
|
|
|
|
|
|
|
|
let start = DateTime.local().toISO(); |
|
|
|
|
let end = DateTime.local().toISO(); |
|
|
|
|
|
|
|
|
|
const {result, loading} = useQuery(GET_SESSION_REL_USER, { |
|
|
|
|
const {result: resultSessions, loading: loadingSessions} = useQuery(GET_SESSION_REL_USER, { |
|
|
|
|
user: "/api/users/" + userId, |
|
|
|
|
beforeStartDate: start, |
|
|
|
|
afterEndDate: end, |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
const sessions = useResult(result, [], ({sessionRelUsers}) => { |
|
|
|
|
const sessions = useResult(resultSessions, [], ({sessionRelUsers}) => { |
|
|
|
|
let sessionList = []; |
|
|
|
|
sessionRelUsers.edges.map(({node}) => { |
|
|
|
|
const sessionExists = sessionList.findIndex(suSession => suSession._id === node.session._id) >= 0; |
|
|
|
@ -51,7 +53,7 @@ export default { |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
sessions, |
|
|
|
|
loading |
|
|
|
|
loadingSessions |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|