forked from jsnbuchanan/crowd-funder-for-time-pwa
remove the last of the localStorage for passing parameters
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
// @ts-check
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useAppStore = defineStore({
|
||||
id: "app",
|
||||
state: () => ({
|
||||
_projectId:
|
||||
typeof localStorage.getItem("projectId") === "undefined"
|
||||
? ""
|
||||
: localStorage.getItem("projectId"),
|
||||
}),
|
||||
getters: {
|
||||
projectId: (state): string => state._projectId as string,
|
||||
},
|
||||
actions: {
|
||||
async setProjectId(newProjectId: string) {
|
||||
localStorage.setItem("projectId", newProjectId);
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -92,8 +92,8 @@ export default class ContactGiftingView extends Vue {
|
||||
allContacts: Array<Contact> = [];
|
||||
apiServer = "";
|
||||
description = "";
|
||||
projectId = localStorage.getItem("projectId") || "";
|
||||
prompt = "What was given";
|
||||
projectId = "";
|
||||
prompt = "";
|
||||
|
||||
async created() {
|
||||
try {
|
||||
@@ -109,9 +109,9 @@ export default class ContactGiftingView extends Vue {
|
||||
(a.name || "").localeCompare(b.name || ""),
|
||||
);
|
||||
|
||||
this.prompt = (this.$route as Router).query["prompt"] ?? this.prompt;
|
||||
this.projectId = (this.$route as Router).query["projectId"] || "";
|
||||
|
||||
localStorage.removeItem("projectId");
|
||||
this.prompt = (this.$route as Router).query["prompt"] ?? this.prompt;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
|
||||
@@ -405,7 +405,6 @@ export default class DiscoverView extends Vue {
|
||||
* @param id of the project
|
||||
**/
|
||||
onClickLoadProject(id: string) {
|
||||
localStorage.setItem("projectId", id);
|
||||
const route = {
|
||||
path: "/project/" + encodeURIComponent(id),
|
||||
};
|
||||
|
||||
@@ -192,7 +192,6 @@ import {
|
||||
getHeaders,
|
||||
PlanVerifiableCredential,
|
||||
} from "@/libs/endorserServer";
|
||||
import { useAppStore } from "@/store/app";
|
||||
|
||||
@Component({
|
||||
components: { ImageMethodDialog, LMap, LMarker, LTileLayer, QuickNav },
|
||||
@@ -224,7 +223,7 @@ export default class NewEditProjectView extends Vue {
|
||||
latitude = 0;
|
||||
longitude = 0;
|
||||
numAccounts = 0;
|
||||
projectId = localStorage.getItem("projectId") || "";
|
||||
projectId = "";
|
||||
projectIssuerDid = "";
|
||||
startDateInput?: string;
|
||||
startTimeInput?: string;
|
||||
@@ -240,6 +239,8 @@ export default class NewEditProjectView extends Vue {
|
||||
this.activeDid = (settings?.activeDid as string) || "";
|
||||
this.apiServer = (settings?.apiServer as string) || "";
|
||||
|
||||
this.projectId = (this.$route as Router).query["projectId"] || "";
|
||||
|
||||
if (this.projectId) {
|
||||
if (this.numAccounts === 0) {
|
||||
this.errNote("There was a problem loading your account info.");
|
||||
@@ -421,11 +422,8 @@ export default class NewEditProjectView extends Vue {
|
||||
if (resp.data?.success?.handleId) {
|
||||
this.errorMessage = "";
|
||||
|
||||
useAppStore()
|
||||
.setProjectId(resp.data.success.handleId)
|
||||
.then(() => {
|
||||
(this.$router as Router).push({ name: "project" });
|
||||
});
|
||||
const projectPath = encodeURIComponent(resp.data.success.handleId);
|
||||
(this.$router as Router).push({ path: "/project/" + projectPath });
|
||||
} else {
|
||||
console.error(
|
||||
"Got unexpected 'data' inside response from server",
|
||||
|
||||
@@ -483,7 +483,7 @@ export default class ProjectViewView extends Vue {
|
||||
name = "";
|
||||
offersToThis: Array<OfferSummaryRecord> = [];
|
||||
offersHitLimit = false;
|
||||
projectId = localStorage.getItem("projectId") || ""; // handle ID
|
||||
projectId = ""; // handle ID
|
||||
showDidCopy = false;
|
||||
startTime = "";
|
||||
truncatedDesc = "";
|
||||
@@ -514,9 +514,9 @@ export default class ProjectViewView extends Vue {
|
||||
}
|
||||
|
||||
onEditClick() {
|
||||
localStorage.setItem("projectId", this.projectId as string);
|
||||
const route = {
|
||||
name: "new-edit-project",
|
||||
query: { projectId: this.projectId },
|
||||
};
|
||||
(this.$router as Router).push(route);
|
||||
}
|
||||
@@ -838,7 +838,6 @@ export default class ProjectViewView extends Vue {
|
||||
* @param id of the project
|
||||
**/
|
||||
async onClickLoadProject(projectId: string) {
|
||||
localStorage.setItem("projectId", projectId);
|
||||
const route = {
|
||||
path: "/project/" + encodeURIComponent(projectId),
|
||||
};
|
||||
@@ -874,9 +873,11 @@ export default class ProjectViewView extends Vue {
|
||||
}
|
||||
|
||||
onClickAllContactsGifting() {
|
||||
localStorage.setItem("projectId", this.projectId);
|
||||
const route = {
|
||||
name: "contact-gift",
|
||||
query: {
|
||||
projectId: this.projectId,
|
||||
},
|
||||
};
|
||||
(this.$router as Router).push(route);
|
||||
}
|
||||
|
||||
@@ -383,7 +383,6 @@ export default class ProjectsView extends Vue {
|
||||
* @param id of the project
|
||||
**/
|
||||
onClickLoadProject(id: string) {
|
||||
localStorage.setItem("projectId", id);
|
||||
const route = {
|
||||
path: "/project/" + encodeURIComponent(id),
|
||||
};
|
||||
@@ -394,7 +393,6 @@ export default class ProjectsView extends Vue {
|
||||
* Handling clicking on the new project button
|
||||
**/
|
||||
onClickNewProject(): void {
|
||||
localStorage.removeItem("projectId");
|
||||
const route = {
|
||||
name: "new-edit-project",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user