Skip to content

Commit

Permalink
Initialise new session from sessions page
Browse files Browse the repository at this point in the history
  • Loading branch information
EmmaLRussell committed Nov 1, 2023
1 parent c9bbd28 commit 619cad4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/static/src/app/components/WodinSession.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
14 changes: 11 additions & 3 deletions app/static/src/app/components/sessions/SessionsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</div>
<div class="row mb-3" id="no-current-session" v-if="!currentSession">
<span>
<router-link to="/" class="brand-link">
<span class="brand-link clickable" @click="newSession">
Start a new session
</router-link>
</span>
<span v-if="previousSessions && previousSessions.length" id="load-previous-span">
or load a previous session.
</span>
Expand Down Expand Up @@ -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";
Expand All @@ -160,6 +160,8 @@ export default defineComponent({
},
setup() {
const store = useStore();
const router = useRouter();
const namespace = "sessions";
const sessionCode = ref("");
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -311,6 +318,7 @@ export default defineComponent({
confirmDeleteSession,
toggleConfirmDeleteSessionOpen,
deleteSession,
newSession,
showUnlabelledSessions,
sessionCode,
loadSessionFromCode,
Expand Down

0 comments on commit 619cad4

Please sign in to comment.