Skip to content

Commit

Permalink
Fixes vue-router redirect.
Browse files Browse the repository at this point in the history
  • Loading branch information
charlon committed Sep 17, 2024
1 parent 47d90c4 commit 8a0a683
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion course_grader_vue/layouts/default.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<li class="nav-item mb-1 position-relative">
<BLink class="d-flex justify-content-between nav-link rounded-3 text-body chevron bg-secondary-hover bg-opacity-10-hover"
:class="$route.path.includes('/term/' + currentTerm.id )|| $route.path.includes('/section/' + currentTerm.id) ? 'bg-secondary bg-opacity-10' : ''"
href="/">
:href="'/term/' + currentTerm.id">
<span><i class="bi bi-house-door-fill me-3"></i>{{ currentTerm.quarter }} {{ currentTerm.year }}</span>
</BLink>
</li>
Expand Down
12 changes: 11 additions & 1 deletion course_grader_vue/router/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { createWebHistory, createRouter } from "vue-router";
import { setActivePinia, createPinia } from 'pinia';

// pinia setup to get current term id from context store
setActivePinia(createPinia());
import { useContextStore } from "@/stores/context";

// access the context store
const contextStore = useContextStore();
const currentTermUrl = contextStore.context.terms[0].url;
console.log(currentTermUrl);

// vue-gtag-next track routing
// import { trackRouter } from "vue-gtag-next";
Expand All @@ -13,7 +23,7 @@ const routes = [
//component: Term,
//props: true,
path: "/",
redirect: "/term/2013-spring",
redirect: currentTermUrl,
},
{
path: "/term/:id?",
Expand Down

0 comments on commit 8a0a683

Please sign in to comment.