Browse Source

add more type casts

Trent Larson 4 months ago
parent
commit
c0df24fe01
  1. 4
      src/libs/endorserServer.ts
  2. 2
      src/views/AccountViewView.vue
  3. 3
      src/views/ClaimAddRawView.vue
  4. 3
      src/views/ConfirmGiftView.vue
  5. 3
      src/views/ContactAmountsView.vue
  6. 5
      src/views/DIDView.vue
  7. 3
      src/views/DiscoverView.vue
  8. 44
      src/views/GiftedDetails.vue
  9. 3
      src/views/IdentitySwitcherView.vue
  10. 5
      src/views/ImportAccountView.vue
  11. 12
      src/views/ImportDerivedAccountView.vue
  12. 6
      src/views/NewEditAccountView.vue
  13. 5
      src/views/NewEditProjectView.vue
  14. 4
      src/views/NewIdentifierView.vue
  15. 17
      src/views/ProjectViewView.vue
  16. 7
      src/views/ProjectsView.vue
  17. 8
      src/views/QuickActionBvcEndView.vue
  18. 3
      src/views/SearchAreaView.vue
  19. 15
      src/views/SharedPhotoView.vue
  20. 9
      src/views/StartView.vue
  21. 3
      src/views/TestView.vue

4
src/libs/endorserServer.ts

@ -56,12 +56,12 @@ export interface GenericVerifiableCredential {
export interface GenericCredWrapper<T extends GenericVerifiableCredential> { export interface GenericCredWrapper<T extends GenericVerifiableCredential> {
"@context": string; "@context": string;
"@type": string; "@type": string;
claim: T;
claimType?: string;
handleId: string; handleId: string;
id: string; id: string;
issuedAt: string; issuedAt: string;
issuer: string; issuer: string;
claim: T;
claimType?: string;
} }
export const BLANK_GENERIC_SERVER_RECORD: GenericCredWrapper<GenericVerifiableCredential> = export const BLANK_GENERIC_SERVER_RECORD: GenericCredWrapper<GenericVerifiableCredential> =
{ {

2
src/views/AccountViewView.vue

@ -1092,7 +1092,7 @@ export default class AccountViewView extends Vue {
} }
async uploadImportFile(event: Event) { async uploadImportFile(event: Event) {
inputImportFileNameRef.value = event.target.files[0]; inputImportFileNameRef.value = (event.target as EventTarget).files[0];
} }
showContactImport() { showContactImport() {

3
src/views/ClaimAddRawView.vue

@ -30,6 +30,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import GiftedDialog from "@/components/GiftedDialog.vue"; import GiftedDialog from "@/components/GiftedDialog.vue";
import { NotificationIface } from "@/constants/app"; import { NotificationIface } from "@/constants/app";
@ -55,7 +56,7 @@ export default class ClaimAddRawView extends Vue {
this.activeDid = settings?.activeDid || ""; this.activeDid = settings?.activeDid || "";
this.apiServer = settings?.apiServer || ""; this.apiServer = settings?.apiServer || "";
this.claimStr = this.$route.query.claim; this.claimStr = (this.$route as Router).query["claim"];
try { try {
this.veriClaim = JSON.parse(this.claimStr); this.veriClaim = JSON.parse(this.claimStr);
this.claimStr = JSON.stringify(this.veriClaim, null, 2); this.claimStr = JSON.stringify(this.veriClaim, null, 2);

3
src/views/ConfirmGiftView.vue

@ -398,6 +398,7 @@ import * as yaml from "js-yaml";
import * as R from "ramda"; import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { useClipboard } from "@vueuse/core"; import { useClipboard } from "@vueuse/core";
import { Router } from "vue-router";
import GiftedDialog from "@/components/GiftedDialog.vue"; import GiftedDialog from "@/components/GiftedDialog.vue";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
@ -764,7 +765,7 @@ export default class ClaimView extends Vue {
const route = { const route = {
path: "/claim/" + encodeURIComponent(claimId), path: "/claim/" + encodeURIComponent(claimId),
}; };
this.$router.push(route).then(async () => { (this.$router as Router).push(route).then(async () => {
this.resetThisValues(); this.resetThisValues();
await this.loadClaim(claimId, this.activeDid); await this.loadClaim(claimId, this.activeDid);
}); });

3
src/views/ContactAmountsView.vue

@ -108,6 +108,7 @@
import { AxiosError, AxiosRequestHeaders } from "axios"; import { AxiosError, AxiosRequestHeaders } from "axios";
import * as R from "ramda"; import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import { NotificationIface } from "@/constants/app"; import { NotificationIface } from "@/constants/app";
@ -144,7 +145,7 @@ export default class ContactAmountssView extends Vue {
async created() { async created() {
try { try {
await db.open(); await db.open();
const contactDid = this.$route.query.contactDid as string; const contactDid = (this.$route as Router).query["contactDid"] as string;
this.contact = (await db.contacts.get(contactDid)) || null; this.contact = (await db.contacts.get(contactDid)) || null;
const settings = await db.settings.get(MASTER_SETTINGS_KEY); const settings = await db.settings.get(MASTER_SETTINGS_KEY);

5
src/views/DIDView.vue

@ -128,6 +128,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import InfiniteScroll from "@/components/InfiniteScroll.vue"; import InfiniteScroll from "@/components/InfiniteScroll.vue";
@ -162,7 +163,7 @@ export default class DIDView extends Vue {
activeDid = ""; activeDid = "";
allMyDids: Array<string> = []; allMyDids: Array<string> = [];
apiServer = ""; apiServer = "";
claims: Array<GenericCredWrapper> = []; claims: Array<GenericCredWrapper<GenericVerifiableCredential>> = [];
contact?: Contact; contact?: Contact;
hitEnd = false; hitEnd = false;
isLoading = false; isLoading = false;
@ -275,7 +276,7 @@ export default class DIDView extends Vue {
const route = { const route = {
path: "/claim/" + encodeURIComponent(jwtId), path: "/claim/" + encodeURIComponent(jwtId),
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
public claimAmount(claim: GenericVerifiableCredential) { public claimAmount(claim: GenericVerifiableCredential) {

3
src/views/DiscoverView.vue

@ -129,6 +129,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import InfiniteScroll from "@/components/InfiniteScroll.vue"; import InfiniteScroll from "@/components/InfiniteScroll.vue";
@ -394,7 +395,7 @@ export default class DiscoverView extends Vue {
const route = { const route = {
path: "/project/" + encodeURIComponent(id), path: "/project/" + encodeURIComponent(id),
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
public computedLocalTabStyleClassNames() { public computedLocalTabStyleClassNames() {

44
src/views/GiftedDetails.vue

@ -250,20 +250,24 @@ export default class GiftedDetails extends Vue {
} }
this.amountInput = this.amountInput =
this.$route.query.amountInput || (this.$route as Router).query["amountInput"] ||
String(this.prevCredToEdit?.claim?.object?.amountOfThisGood) || String(this.prevCredToEdit?.claim?.object?.amountOfThisGood) ||
this.amountInput; this.amountInput;
this.description = this.description =
this.$route.query.description || (this.$route as Router).query["description"] ||
this.prevCredToEdit?.claim?.description || this.prevCredToEdit?.claim?.description ||
this.description; this.description;
this.destinationPathAfter = this.$route.query.destinationPathAfter; this.destinationPathAfter = (this.$route as Router).query[
this.giverDid = (this.$route.query.giverDid || "destinationPathAfter"
];
this.giverDid = ((this.$route as Router).query["giverDid"] ||
this.prevCredToEdit?.claim?.agent?.identifier || this.prevCredToEdit?.claim?.agent?.identifier ||
this.giverDid) as string; this.giverDid) as string;
this.giverName = (this.$route.query.giverName as string) || ""; this.giverName =
this.hideBackButton = this.$route.query.hideBackButton === "true"; ((this.$route as Router).query["giverName"] as string) || "";
this.message = (this.$route.query.message as string) || ""; this.hideBackButton =
(this.$route as Router).query["hideBackButton"] === "true";
this.message = ((this.$route as Router).query["message"] as string) || "";
// find any offer ID // find any offer ID
const fulfills = this.prevCredToEdit?.claim?.fulfills; const fulfills = this.prevCredToEdit?.claim?.fulfills;
const fulfillsArray = Array.isArray(fulfills) const fulfillsArray = Array.isArray(fulfills)
@ -272,43 +276,44 @@ export default class GiftedDetails extends Vue {
? [fulfills] ? [fulfills]
: []; : [];
const offer = fulfillsArray.find((rec) => rec.claimType === "Offer"); const offer = fulfillsArray.find((rec) => rec.claimType === "Offer");
this.offerId = (this.$route.query.offerId || this.offerId = ((this.$route as Router).query["offerId"] ||
offer?.identifier || offer?.identifier ||
this.offerId) as string; this.offerId) as string;
// find any project ID // find any project ID
const project = fulfillsArray.find((rec) => rec.claimType === "PlanAction"); const project = fulfillsArray.find((rec) => rec.claimType === "PlanAction");
this.projectId = (this.$route.query.projectId || this.projectId = ((this.$route as Router).query["projectId"] ||
project?.identifier || project?.identifier ||
this.projectId) as string; this.projectId) as string;
this.recipientDid = (this.$route.query.recipientDid || this.recipientDid = ((this.$route as Router).query["recipientDid"] ||
this.prevCredToEdit?.claim?.recipient?.identifier) as string; this.prevCredToEdit?.claim?.recipient?.identifier) as string;
this.recipientName = (this.$route.query.recipientName as string) || ""; this.recipientName =
this.unitCode = (this.$route.query.unitCode || ((this.$route as Router).query["recipientName"] as string) || "";
this.unitCode = ((this.$route as Router).query["unitCode"] ||
this.prevCredToEdit?.claim?.object?.unitCode || this.prevCredToEdit?.claim?.object?.unitCode ||
this.unitCode) as string; this.unitCode) as string;
this.imageUrl = this.imageUrl =
(this.$route.query.imageUrl as string) || ((this.$route as Router).query["imageUrl"] as string) ||
this.prevCredToEdit?.claim?.image || this.prevCredToEdit?.claim?.image ||
localStorage.getItem("imageUrl") || localStorage.getItem("imageUrl") ||
this.imageUrl; this.imageUrl;
// this is an endpoint for sharing project info to highlight something given // this is an endpoint for sharing project info to highlight something given
// https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target // https://developer.mozilla.org/en-US/docs/Web/Manifest/share_target
if (this.$route.query.shareTitle) { if ((this.$route as Router).query["shareTitle"]) {
this.description = this.description =
(this.$route.query.shareTitle as string) + ((this.$route as Router).query["shareTitle"] as string) +
(this.description ? "\n" + this.description : ""); (this.description ? "\n" + this.description : "");
} }
if (this.$route.query.shareText) { if ((this.$route as Router).query["shareText"]) {
this.description = this.description =
(this.description ? this.description + "\n" : "") + (this.description ? this.description + "\n" : "") +
(this.$route.query.shareText as string); ((this.$route as Router).query["shareText"] as string);
} }
if (this.$route.query.shareUrl) { if ((this.$route as Router).query["shareUrl"]) {
this.imageUrl = this.$route.query.shareUrl as string; this.imageUrl = (this.$route as Router).query["shareUrl"] as string;
} }
try { try {
@ -688,6 +693,7 @@ export default class GiftedDetails extends Vue {
constructGiveParam() { constructGiveParam() {
const recipientDid = this.givenToRecipient ? this.recipientDid : undefined; const recipientDid = this.givenToRecipient ? this.recipientDid : undefined;
const projectId = this.givenToProject ? this.projectId : undefined; const projectId = this.givenToProject ? this.projectId : undefined;
// const giveClaim = constructGive(
const giveClaim = hydrateGive( const giveClaim = hydrateGive(
this.prevCredToEdit?.claim as GiveVerifiableCredential, this.prevCredToEdit?.claim as GiveVerifiableCredential,
this.giverDid, this.giverDid,

3
src/views/IdentitySwitcherView.vue

@ -99,6 +99,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { NotificationIface } from "@/constants/app"; import { NotificationIface } from "@/constants/app";
import { db, accountsDB } from "@/db/index"; import { db, accountsDB } from "@/db/index";
@ -155,7 +156,7 @@ export default class IdentitySwitcherView extends Vue {
await db.settings.update(MASTER_SETTINGS_KEY, { await db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: did, activeDid: did,
}); });
this.$router.push({ name: "account" }); (this.$router as Router).push({ name: "account" });
} }
async deleteAccount(id: string) { async deleteAccount(id: string) {

5
src/views/ImportAccountView.vue

@ -77,6 +77,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { NotificationIface } from "@/constants/app"; import { NotificationIface } from "@/constants/app";
import { accountsDB, db } from "@/db/index"; import { accountsDB, db } from "@/db/index";
@ -110,7 +111,7 @@ export default class ImportAccountView extends Vue {
} }
public onCancelClick() { public onCancelClick() {
this.$router.back(); (this.$router as Router).back();
} }
public async fromMnemonic() { public async fromMnemonic() {
@ -146,7 +147,7 @@ export default class ImportAccountView extends Vue {
await db.settings.update(MASTER_SETTINGS_KEY, { await db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: newId.did, activeDid: newId.did,
}); });
this.$router.push({ name: "account" }); (this.$router as Router).push({ name: "account" });
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (err: any) { } catch (err: any) {
console.error("Error saving mnemonic & updating settings:", err); console.error("Error saving mnemonic & updating settings:", err);

12
src/views/ImportDerivedAccountView.vue

@ -70,6 +70,8 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { import {
DEFAULT_ROOT_DERIVATION_PATH, DEFAULT_ROOT_DERIVATION_PATH,
deriveAddress, deriveAddress,
@ -100,7 +102,7 @@ export default class ImportAccountView extends Vue {
} }
public onCancelClick() { public onCancelClick() {
this.$router.back(); (this.$router as Router).back();
} }
public switchAccount(did: string) { public switchAccount(did: string) {
@ -124,9 +126,11 @@ export default class ImportAccountView extends Vue {
} }
}); });
// increment the last number in that max derivation path // increment the last number in that max derivation path
const newDerivPath = nextDerivationPath(accountWithMaxDeriv.derivationPath); const newDerivPath = nextDerivationPath(
accountWithMaxDeriv.derivationPath as string,
);
const mne: string = accountWithMaxDeriv.mnemonic; const mne: string = accountWithMaxDeriv.mnemonic as string;
const [address, privateHex, publicHex] = deriveAddress(mne, newDerivPath); const [address, privateHex, publicHex] = deriveAddress(mne, newDerivPath);
@ -147,7 +151,7 @@ export default class ImportAccountView extends Vue {
await db.settings.update(MASTER_SETTINGS_KEY, { await db.settings.update(MASTER_SETTINGS_KEY, {
activeDid: newId.did, activeDid: newId.did,
}); });
this.$router.push({ name: "account" }); (this.$router as Router).push({ name: "account" });
} catch (err) { } catch (err) {
console.error("Error saving mnemonic & updating settings:", err); console.error("Error saving mnemonic & updating settings:", err);
} }

6
src/views/NewEditAccountView.vue

@ -45,6 +45,8 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { db } from "@/db/index"; import { db } from "@/db/index";
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings"; import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings";
@ -68,11 +70,11 @@ export default class NewEditAccountView extends Vue {
firstName: this.givenName, firstName: this.givenName,
lastName: "", // deprecated, pre v 0.1.3 lastName: "", // deprecated, pre v 0.1.3
}); });
this.$router.back(); (this.$router as Router).back();
} }
onClickCancel() { onClickCancel() {
this.$router.back(); (this.$router as Router).back();
} }
} }
</script> </script>

5
src/views/NewEditProjectView.vue

@ -180,6 +180,7 @@ import { AxiosError, AxiosRequestHeaders } from "axios";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet"; import { LMap, LMarker, LTileLayer } from "@vue-leaflet/vue-leaflet";
import { Router } from "vue-router";
import ImageMethodDialog from "@/components/ImageMethodDialog.vue"; import ImageMethodDialog from "@/components/ImageMethodDialog.vue";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
@ -423,7 +424,7 @@ export default class NewEditProjectView extends Vue {
useAppStore() useAppStore()
.setProjectId(resp.data.success.handleId) .setProjectId(resp.data.success.handleId)
.then(() => { .then(() => {
this.$router.push({ name: "project" }); (this.$router as Router).push({ name: "project" });
}); });
} else { } else {
console.error( console.error(
@ -521,7 +522,7 @@ export default class NewEditProjectView extends Vue {
} }
public onCancelClick() { public onCancelClick() {
this.$router.back(); (this.$router as Router).back();
} }
} }
</script> </script>

4
src/views/NewIdentifierView.vue

@ -54,6 +54,8 @@
<script lang="ts"> <script lang="ts">
import "dexie-export-import"; import "dexie-export-import";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { generateSaveAndActivateIdentity } from "@/libs/util"; import { generateSaveAndActivateIdentity } from "@/libs/util";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
@ -65,7 +67,7 @@ export default class NewIdentifierView extends Vue {
await generateSaveAndActivateIdentity(); await generateSaveAndActivateIdentity();
this.loading = false; this.loading = false;
setTimeout(() => { setTimeout(() => {
this.$router.push({ name: "home" }); (this.$router as Router).push({ name: "home" });
}, 1000); }, 1000);
} }
} }

17
src/views/ProjectViewView.vue

@ -404,6 +404,7 @@
<script lang="ts"> <script lang="ts">
import { AxiosError } from "axios"; import { AxiosError } from "axios";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import GiftedDialog from "@/components/GiftedDialog.vue"; import GiftedDialog from "@/components/GiftedDialog.vue";
import OfferDialog from "@/components/OfferDialog.vue"; import OfferDialog from "@/components/OfferDialog.vue";
@ -423,7 +424,9 @@ import {
getHeaders, getHeaders,
GiverReceiverInputInfo, GiverReceiverInputInfo,
GiveSummaryRecord, GiveSummaryRecord,
GiveVerifiableCredential,
OfferSummaryRecord, OfferSummaryRecord,
OfferVerifiableCredential,
PlanSummaryRecord, PlanSummaryRecord,
} from "@/libs/endorserServer"; } from "@/libs/endorserServer";
import * as serverUtil from "@/libs/endorserServer"; import * as serverUtil from "@/libs/endorserServer";
@ -496,7 +499,7 @@ export default class ProjectViewView extends Vue {
const route = { const route = {
name: "new-edit-project", name: "new-edit-project",
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
// Isn't there a better way to make this available to the template? // Isn't there a better way to make this available to the template?
@ -820,7 +823,7 @@ export default class ProjectViewView extends Vue {
const route = { const route = {
path: "/project/" + encodeURIComponent(projectId), path: "/project/" + encodeURIComponent(projectId),
}; };
this.$router.push(route); (this.$router as Router).push(route);
this.loadProject(projectId, this.activeDid); this.loadProject(projectId, this.activeDid);
} }
@ -856,18 +859,18 @@ export default class ProjectViewView extends Vue {
const route = { const route = {
name: "contact-gift", name: "contact-gift",
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
onClickLoadClaim(jwtId: string) { onClickLoadClaim(jwtId: string) {
const route = { const route = {
path: "/claim/" + encodeURIComponent(jwtId), path: "/claim/" + encodeURIComponent(jwtId),
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
checkIsFulfillable(offer: OfferSummaryRecord) { checkIsFulfillable(offer: OfferSummaryRecord) {
const offerRecord: GenericCredWrapper = { const offerRecord: GenericCredWrapper<OfferVerifiableCredential> = {
...BLANK_GENERIC_SERVER_RECORD, ...BLANK_GENERIC_SERVER_RECORD,
claim: offer.fullClaim, claim: offer.fullClaim,
claimType: "Offer", claimType: "Offer",
@ -877,7 +880,7 @@ export default class ProjectViewView extends Vue {
} }
onClickFulfillGiveToOffer(offer: OfferSummaryRecord) { onClickFulfillGiveToOffer(offer: OfferSummaryRecord) {
const offerRecord: GenericCredWrapper = { const offerRecord: GenericCredWrapper<OfferVerifiableCredential> = {
...BLANK_GENERIC_SERVER_RECORD, ...BLANK_GENERIC_SERVER_RECORD,
claim: offer.fullClaim, claim: offer.fullClaim,
issuer: offer.offeredByDid, issuer: offer.offeredByDid,
@ -922,7 +925,7 @@ export default class ProjectViewView extends Vue {
} }
checkIsConfirmable(give: GiveSummaryRecord) { checkIsConfirmable(give: GiveSummaryRecord) {
const giveDetails: GenericCredWrapper = { const giveDetails: GenericCredWrapper<GiveVerifiableCredential> = {
...BLANK_GENERIC_SERVER_RECORD, ...BLANK_GENERIC_SERVER_RECORD,
claim: give.fullClaim, claim: give.fullClaim,
claimType: "GiveAction", claimType: "GiveAction",

7
src/views/ProjectsView.vue

@ -229,6 +229,7 @@
<script lang="ts"> <script lang="ts">
import { AxiosRequestConfig } from "axios"; import { AxiosRequestConfig } from "axios";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { NotificationIface } from "@/constants/app"; import { NotificationIface } from "@/constants/app";
import { accountsDB, db } from "@/db/index"; import { accountsDB, db } from "@/db/index";
@ -364,7 +365,7 @@ export default class ProjectsView extends Vue {
const route = { const route = {
path: "/project/" + encodeURIComponent(id), path: "/project/" + encodeURIComponent(id),
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
/** /**
@ -375,14 +376,14 @@ export default class ProjectsView extends Vue {
const route = { const route = {
name: "new-edit-project", name: "new-edit-project",
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
onClickLoadClaim(jwtId: string) { onClickLoadClaim(jwtId: string) {
const route = { const route = {
path: "/claim/" + encodeURIComponent(jwtId), path: "/claim/" + encodeURIComponent(jwtId),
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
/** /**

8
src/views/QuickActionBvcEndView.vue

@ -139,6 +139,7 @@ import axios from "axios";
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import * as R from "ramda"; import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import TopMessage from "@/components/TopMessage.vue"; import TopMessage from "@/components/TopMessage.vue";
@ -174,7 +175,7 @@ export default class QuickActionBvcBeginView extends Vue {
apiServer = ""; apiServer = "";
claimCountByUser = 0; claimCountByUser = 0;
claimCountWithHidden = 0; claimCountWithHidden = 0;
claimsToConfirm: GenericCredWrapper[] = []; claimsToConfirm: GenericCredWrapper<GenericVerifiableCredential>[] = [];
claimsToConfirmSelected: string[] = []; claimsToConfirmSelected: string[] = [];
description = "breakfast"; description = "breakfast";
loadingConfirms = true; loadingConfirms = true;
@ -227,7 +228,8 @@ export default class QuickActionBvcBeginView extends Vue {
} }
await response.json().then((data) => { await response.json().then((data) => {
const dataByOthers = R.reject( const dataByOthers = R.reject(
(claim: GenericCredWrapper) => claim.issuer === this.activeDid, (claim: GenericCredWrapper<GenericVerifiableCredential>) =>
claim.issuer === this.activeDid,
data, data,
); );
const dataByOthersWithoutHidden = R.reject( const dataByOthersWithoutHidden = R.reject(
@ -258,7 +260,7 @@ export default class QuickActionBvcBeginView extends Vue {
const route = { const route = {
path: "/claim/" + encodeURIComponent(jwtId), path: "/claim/" + encodeURIComponent(jwtId),
}; };
this.$router.push(route); (this.$router as Router).push(route);
} }
async record() { async record() {

3
src/views/SearchAreaView.vue

@ -105,6 +105,7 @@ import {
LRectangle, LRectangle,
LTileLayer, LTileLayer,
} from "@vue-leaflet/vue-leaflet"; } from "@vue-leaflet/vue-leaflet";
import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import { NotificationIface } from "@/constants/app"; import { NotificationIface } from "@/constants/app";
@ -213,7 +214,7 @@ export default class DiscoverView extends Vue {
}, },
7000, 7000,
); );
this.$router.back(); (this.$router as Router).back();
} catch (err) { } catch (err) {
this.$notify( this.$notify(
{ {

15
src/views/SharedPhotoView.vue

@ -55,6 +55,7 @@
<script lang="ts"> <script lang="ts">
import axios from "axios"; import axios from "axios";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { RouteLocationRaw, Router } from "vue-router";
import PhotoDialog from "@/components/PhotoDialog.vue"; import PhotoDialog from "@/components/PhotoDialog.vue";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
@ -92,7 +93,9 @@ export default class SharedPhotoView extends Vue {
// clear the temp image // clear the temp image
db.temp.delete("shared-photo"); db.temp.delete("shared-photo");
this.imageFileName = this.$route.query.fileName as string; this.imageFileName = (this.$route as Router).query[
"fileName"
] as string;
} }
} catch (err: unknown) { } catch (err: unknown) {
console.error("Got an error loading an identifier:", err); console.error("Got an error loading an identifier:", err);
@ -111,15 +114,17 @@ export default class SharedPhotoView extends Vue {
async recordGift() { async recordGift() {
await this.sendToImageServer("GiveAction").then((url) => { await this.sendToImageServer("GiveAction").then((url) => {
if (url) { if (url) {
this.$router.push({ const route = {
name: "gifted-details", name: "gifted-details",
// this might be wrong since "name" goes with params, but it works so test well when you change it
query: { query: {
destinationPathAfter: "/home", destinationPathAfter: "/home",
hideBackButton: true, hideBackButton: true,
imageUrl: url, imageUrl: url,
recipientDid: this.activeDid, recipientDid: this.activeDid,
}, },
}); } as RouteLocationRaw;
(this.$router as Router).push(route);
} }
}); });
} }
@ -130,7 +135,7 @@ export default class SharedPhotoView extends Vue {
await db.settings.update(MASTER_SETTINGS_KEY, { await db.settings.update(MASTER_SETTINGS_KEY, {
profileImageUrl: imgUrl, profileImageUrl: imgUrl,
}); });
this.$router.push({ name: "account" }); (this.$router as Router).push({ name: "account" });
}, },
IMAGE_TYPE_PROFILE, IMAGE_TYPE_PROFILE,
true, true,
@ -142,7 +147,7 @@ export default class SharedPhotoView extends Vue {
async cancel() { async cancel() {
this.imageBlob = undefined; this.imageBlob = undefined;
this.imageFileName = undefined; this.imageFileName = undefined;
this.$router.push({ name: "home" }); (this.$router as Router).push({ name: "home" });
} }
async sendToImageServer(imageType: string) { async sendToImageServer(imageType: string) {

9
src/views/StartView.vue

@ -88,6 +88,7 @@
<script lang="ts"> <script lang="ts">
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { AppString, PASSKEYS_ENABLED } from "@/constants/app"; import { AppString, PASSKEYS_ENABLED } from "@/constants/app";
import { accountsDB, db } from "@/db/index"; import { accountsDB, db } from "@/db/index";
@ -113,22 +114,22 @@ export default class StartView extends Vue {
} }
public onClickNewSeed() { public onClickNewSeed() {
this.$router.push({ name: "new-identifier" }); (this.$router as Router).push({ name: "new-identifier" });
} }
public async onClickNewPasskey() { public async onClickNewPasskey() {
const keyName = const keyName =
AppString.APP_NAME + (this.givenName ? " - " + this.givenName : ""); AppString.APP_NAME + (this.givenName ? " - " + this.givenName : "");
await registerSaveAndActivatePasskey(keyName); await registerSaveAndActivatePasskey(keyName);
this.$router.push({ name: "account" }); (this.$router as Router).push({ name: "account" });
} }
public onClickNo() { public onClickNo() {
this.$router.push({ name: "import-account" }); (this.$router as Router).push({ name: "import-account" });
} }
public onClickDerive() { public onClickDerive() {
this.$router.push({ name: "import-derive" }); (this.$router as Router).push({ name: "import-derive" });
} }
} }
</script> </script>

3
src/views/TestView.vue

@ -242,6 +242,7 @@ import { Buffer } from "buffer/";
import { Base64URLString } from "@simplewebauthn/types"; import { Base64URLString } from "@simplewebauthn/types";
import { ref } from "vue"; import { ref } from "vue";
import { Component, Vue } from "vue-facing-decorator"; import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import QuickNav from "@/components/QuickNav.vue"; import QuickNav from "@/components/QuickNav.vue";
import { AppString, NotificationIface } from "@/constants/app"; import { AppString, NotificationIface } from "@/constants/app";
@ -349,7 +350,7 @@ export default class Help extends Vue {
this.userName = DEFAULT_USERNAME; this.userName = DEFAULT_USERNAME;
}, },
onYes: async () => { onYes: async () => {
this.$router.push({ name: "new-edit-account" }); (this.$router as Router).push({ name: "new-edit-account" });
}, },
noText: "try again and use " + DEFAULT_USERNAME, noText: "try again and use " + DEFAULT_USERNAME,
}, },

Loading…
Cancel
Save