forked from trent_larson/crowd-funder-for-time-pwa
refactor: move ProviderInfo interface to claims-result.ts
- Move ProviderInfo interface from ClaimView.vue to claims-result.ts - Add JSDoc documentation to interface properties - Update imports in ClaimView.vue - Clean up route handling using vue-router types - Remove outdated browser compatibility comment This improves type organization and documentation while reducing component-level interface definitions.
This commit is contained in:
@@ -37,6 +37,17 @@ export interface WorldProperties {
|
|||||||
endTime?: string;
|
endTime?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProviderInfo {
|
||||||
|
/**
|
||||||
|
* Could be a DID or a handleId that identifies the provider
|
||||||
|
*/
|
||||||
|
identifier: string;
|
||||||
|
/**
|
||||||
|
* Indicates if the provider link has been confirmed
|
||||||
|
*/
|
||||||
|
linkConfirmed: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
// Type for createAndSubmitClaim result
|
// Type for createAndSubmitClaim result
|
||||||
export type CreateAndSubmitClaimResult = SuccessResult | ErrorResult;
|
export type CreateAndSubmitClaimResult = SuccessResult | ErrorResult;
|
||||||
|
|
||||||
|
|||||||
@@ -97,15 +97,15 @@ const handleDeepLink = async (data: { url: string }) => {
|
|||||||
const paramRoutes = {
|
const paramRoutes = {
|
||||||
"claim-add-raw": /^claim-add-raw\/(.+)$/,
|
"claim-add-raw": /^claim-add-raw\/(.+)$/,
|
||||||
"claim-cert": /^claim-cert\/(.+)$/,
|
"claim-cert": /^claim-cert\/(.+)$/,
|
||||||
claim: /^claim\/(.+)$/,
|
"claim": /^claim\/(.+)$/,
|
||||||
"confirm-gift": /^confirm-gift\/(.+)$/,
|
"confirm-gift": /^confirm-gift\/(.+)$/,
|
||||||
"contact-edit": /^contact-edit\/(.+)$/,
|
"contact-edit": /^contact-edit\/(.+)$/,
|
||||||
"contact-import": /^contact-import\/(.+)$/,
|
"contact-import": /^contact-import\/(.+)$/,
|
||||||
did: /^did\/(.+)$/,
|
"did": /^did\/(.+)$/,
|
||||||
"invite-one-accept": /^invite-one-accept\/(.+)$/,
|
"invite-one-accept": /^invite-one-accept\/(.+)$/,
|
||||||
"offer-details": /^offer-details\/(.+)$/,
|
"offer-details": /^offer-details\/(.+)$/,
|
||||||
project: /^project\/(.+)$/,
|
"project": /^project\/(.+)$/,
|
||||||
userProfile: /^userProfile\/(.+)$/,
|
"user-profile": /^user-profile\/(.+)$/,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Match route pattern and extract parameter
|
// Match route pattern and extract parameter
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ const routes: Array<RouteRecordRaw> = [
|
|||||||
component: () => import("../views/TestView.vue"),
|
component: () => import("../views/TestView.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/userProfile/:id?",
|
path: "/user-profile/:id?",
|
||||||
name: "userProfile",
|
name: "user-profile",
|
||||||
component: () => import("../views/UserProfileView.vue"),
|
component: () => import("../views/UserProfileView.vue"),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ import { AxiosError } from "axios";
|
|||||||
import * as yaml from "js-yaml";
|
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 { Router } from "vue-router";
|
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
|
||||||
import { useClipboard } from "@vueuse/core";
|
import { useClipboard } from "@vueuse/core";
|
||||||
|
|
||||||
import GiftedDialog from "../components/GiftedDialog.vue";
|
import GiftedDialog from "../components/GiftedDialog.vue";
|
||||||
@@ -518,22 +518,20 @@ import {
|
|||||||
} from "../db/index";
|
} from "../db/index";
|
||||||
import { Contact } from "../db/tables/contacts";
|
import { Contact } from "../db/tables/contacts";
|
||||||
import * as serverUtil from "../libs/endorserServer";
|
import * as serverUtil from "../libs/endorserServer";
|
||||||
import {
|
import {
|
||||||
GenericCredWrapper,
|
GenericCredWrapper,
|
||||||
OfferVerifiableCredential,
|
OfferVerifiableCredential,
|
||||||
} from "../libs/endorserServer";
|
ProviderInfo
|
||||||
|
} from '../interfaces';
|
||||||
import * as libsUtil from "../libs/util";
|
import * as libsUtil from "../libs/util";
|
||||||
|
|
||||||
interface ProviderInfo {
|
|
||||||
identifier: string; // could be a DID or a handleId
|
|
||||||
linkConfirmed: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
components: { GiftedDialog, QuickNav },
|
components: { GiftedDialog, QuickNav },
|
||||||
})
|
})
|
||||||
export default class ClaimView extends Vue {
|
export default class ClaimView extends Vue {
|
||||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||||
|
$route!: RouteLocationNormalizedLoaded;
|
||||||
|
$router!: Router;
|
||||||
|
|
||||||
activeDid = "";
|
activeDid = "";
|
||||||
allMyDids: Array<string> = [];
|
allMyDids: Array<string> = [];
|
||||||
@@ -595,41 +593,30 @@ export default class ClaimView extends Vue {
|
|||||||
try {
|
try {
|
||||||
this.allMyDids = await libsUtil.retrieveAccountDids();
|
this.allMyDids = await libsUtil.retrieveAccountDids();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// continue because we want to see claims, even anonymously
|
|
||||||
logConsoleAndDb(
|
logConsoleAndDb(
|
||||||
"Error retrieving all account DIDs on home page:" + error,
|
"Error retrieving all account DIDs on home page:" + error,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
this.$notify(
|
this.$notify({
|
||||||
{
|
group: "alert",
|
||||||
group: "alert",
|
type: "danger",
|
||||||
type: "danger",
|
title: "Error Loading Profile",
|
||||||
title: "Error Loading Profile",
|
text: "See the Help page for problems with your personal data.",
|
||||||
text: "See the Help page for problems with your personal data.",
|
}, 5000);
|
||||||
},
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pathParam = window.location.pathname.substring("/claim/".length);
|
const claimId = this.$route.params.id as string;
|
||||||
let claimId;
|
if (claimId) {
|
||||||
if (pathParam) {
|
|
||||||
claimId = decodeURIComponent(pathParam);
|
|
||||||
await this.loadClaim(claimId, this.activeDid);
|
await this.loadClaim(claimId, this.activeDid);
|
||||||
} else {
|
} else {
|
||||||
this.$notify(
|
this.$notify({
|
||||||
{
|
group: "alert",
|
||||||
group: "alert",
|
type: "danger",
|
||||||
type: "danger",
|
title: "Error",
|
||||||
title: "Error",
|
text: "No claim ID was provided.",
|
||||||
text: "No claim ID was provided.",
|
}, 5000);
|
||||||
},
|
|
||||||
5000,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// When Chrome compatibility is fixed https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API#api.navigator.canshare
|
|
||||||
// then use this truer check: navigator.canShare && navigator.canShare()
|
|
||||||
this.canShare = !!navigator.share;
|
this.canShare = !!navigator.share;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user