From 1c0881fe14c49723aa7d15fbed353f65ade1b291 Mon Sep 17 00:00:00 2001 From: Matthew Aaron Raymer Date: Tue, 10 Jan 2023 16:22:07 +0800 Subject: [PATCH] Subject: workflow for saving of project * Changed from passing parameters since this isn't supported anymore by Vue * Added new AppStore values for a projectId which are accessible in the ProjectView View --- src/store/app.ts | 8 ++++++++ src/views/NewEditProjectView.vue | 3 ++- src/views/ProjectViewView.vue | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/store/app.ts b/src/store/app.ts index 3ab7b8c..f3cc0c4 100644 --- a/src/store/app.ts +++ b/src/store/app.ts @@ -12,9 +12,14 @@ export const useAppStore = defineStore({ typeof localStorage["lastView"] == "undefined" ? "/start" : localStorage["lastView"], + _projectId: + typeof localStorage.getItem("projectId") === "undefined" + ? "" + : localStorage.getItem("projectId"), }), getters: { condition: (state) => state._condition, + projectId: (state): string => state._projectId as string, }, actions: { reset() { @@ -23,5 +28,8 @@ export const useAppStore = defineStore({ setCondition(newCondition: string) { localStorage.setItem("condition", newCondition); }, + setProjectId(newProjectId: string) { + localStorage.setItem("projectId", newProjectId); + }, }, }); diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index 545e3e1..1fffbcd 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -76,6 +76,7 @@ import { db } from "../db"; import { accessToken, SimpleSigner } from "@/libs/crypto"; import * as didJwt from "did-jwt"; import { IIdentifier } from "@veramo/core"; +import { useAppStore } from "@/store/app"; @Options({ components: {}, @@ -133,9 +134,9 @@ export default class NewEditProjectView extends Vue { try { const resp = await this.axios.post(url, payload, { headers }); console.log(resp.status, resp.data); + useAppStore().setProjectId(resp.data); const route = { name: "project", - params: { projectId: resp.data }, }; console.log(route); this.$router.push(route); diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index a95f248..0c6c669 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -126,6 +126,7 @@