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:
Matthew Raymer
2025-02-25 09:03:18 +00:00
parent 79ef59c5a9
commit 73637d80dc
4 changed files with 38 additions and 40 deletions

View File

@@ -505,7 +505,7 @@ import { AxiosError } from "axios";
import * as yaml from "js-yaml";
import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator";
import { Router } from "vue-router";
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
import { useClipboard } from "@vueuse/core";
import GiftedDialog from "../components/GiftedDialog.vue";
@@ -518,22 +518,20 @@ import {
} from "../db/index";
import { Contact } from "../db/tables/contacts";
import * as serverUtil from "../libs/endorserServer";
import {
GenericCredWrapper,
import {
GenericCredWrapper,
OfferVerifiableCredential,
} from "../libs/endorserServer";
ProviderInfo
} from '../interfaces';
import * as libsUtil from "../libs/util";
interface ProviderInfo {
identifier: string; // could be a DID or a handleId
linkConfirmed: boolean;
}
@Component({
components: { GiftedDialog, QuickNav },
})
export default class ClaimView extends Vue {
$notify!: (notification: NotificationIface, timeout?: number) => void;
$route!: RouteLocationNormalizedLoaded;
$router!: Router;
activeDid = "";
allMyDids: Array<string> = [];
@@ -595,41 +593,30 @@ export default class ClaimView extends Vue {
try {
this.allMyDids = await libsUtil.retrieveAccountDids();
} catch (error) {
// continue because we want to see claims, even anonymously
logConsoleAndDb(
"Error retrieving all account DIDs on home page:" + error,
true,
);
this.$notify(
{
group: "alert",
type: "danger",
title: "Error Loading Profile",
text: "See the Help page for problems with your personal data.",
},
5000,
);
this.$notify({
group: "alert",
type: "danger",
title: "Error Loading Profile",
text: "See the Help page for problems with your personal data.",
}, 5000);
}
const pathParam = window.location.pathname.substring("/claim/".length);
let claimId;
if (pathParam) {
claimId = decodeURIComponent(pathParam);
const claimId = this.$route.params.id as string;
if (claimId) {
await this.loadClaim(claimId, this.activeDid);
} else {
this.$notify(
{
group: "alert",
type: "danger",
title: "Error",
text: "No claim ID was provided.",
},
5000,
);
this.$notify({
group: "alert",
type: "danger",
title: "Error",
text: "No claim ID was provided.",
}, 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;
}