From 619cad4d1a0e0ccfe075866b06701c99fa1baef9 Mon Sep 17 00:00:00 2001 From: EmmaLRussell Date: Wed, 1 Nov 2023 14:42:52 +0000 Subject: [PATCH] Initialise new session from sessions page --- app/static/src/app/components/WodinSession.vue | 1 - .../src/app/components/sessions/SessionsPage.vue | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/static/src/app/components/WodinSession.vue b/app/static/src/app/components/WodinSession.vue index eee95ffd2..c49138b53 100644 --- a/app/static/src/app/components/WodinSession.vue +++ b/app/static/src/app/components/WodinSession.vue @@ -68,7 +68,6 @@ export default defineComponent({ }); const initialise = (sessionId: string, copySession = true) => { - console.log(`Initialising with sessionId: ${sessionId}, copySession: ${copySession}`) store.dispatch(AppStateAction.InitialiseSession, { loadSessionId: sessionId, copySession }); sessionInitialised.value = true; }; diff --git a/app/static/src/app/components/sessions/SessionsPage.vue b/app/static/src/app/components/sessions/SessionsPage.vue index 4d8117a80..44a53f04c 100644 --- a/app/static/src/app/components/sessions/SessionsPage.vue +++ b/app/static/src/app/components/sessions/SessionsPage.vue @@ -6,9 +6,9 @@
- + Start a new session - + or load a previous session. @@ -140,7 +140,7 @@ import { } from "vue"; import { useStore } from "vuex"; import VueFeather from "vue-feather"; -import { RouterLink } from "vue-router"; +import {RouterLink, useRouter} from "vue-router"; import { AppStateAction } from "../../store/appState/actions"; import { SessionsAction } from "../../store/sessions/actions"; import userMessages from "../../userMessages"; @@ -160,6 +160,8 @@ export default defineComponent({ }, setup() { const store = useStore(); + const router = useRouter(); + const namespace = "sessions"; const sessionCode = ref(""); @@ -278,6 +280,11 @@ export default defineComponent({ store.dispatch(`${namespace}/${SessionsAction.DeleteSession}`, sessionIdToDelete.value); }; + const newSession = () => { + store.dispatch(AppStateAction.InitialiseSession, { loadSessionId: "", copySession: false }); + router.push("/"); + }; + const loadSessionFromCode = () => { const link = getShareSessionLink(sessionCode.value); window.location.assign(link); @@ -311,6 +318,7 @@ export default defineComponent({ confirmDeleteSession, toggleConfirmDeleteSessionOpen, deleteSession, + newSession, showUnlabelledSessions, sessionCode, loadSessionFromCode,