forked from jsnbuchanan/crowd-funder-for-time-pwa
fix: improve TypeScript type safety across views
Changes: - Add proper type annotations for component properties - Fix null checks with optional chaining - Add missing interface properties - Replace any with proper types where possible - Move interfaces from endorserServer to interfaces/ - Add proper Router and Route typing - Add default empty string for optional text fields This improves type safety and reduces TypeScript errors across views.
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Router } from "vue-router";
|
||||
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
@@ -38,12 +37,15 @@ import { logConsoleAndDb, retrieveSettingsForActiveAccount } from "../db/index";
|
||||
import * as serverUtil from "../libs/endorserServer";
|
||||
import * as libsUtil from "../libs/util";
|
||||
import { errorStringForLog } from "../libs/endorserServer";
|
||||
import { Router, RouteLocationNormalizedLoaded } from "vue-router";
|
||||
|
||||
@Component({
|
||||
components: { QuickNav },
|
||||
})
|
||||
export default class ClaimAddRawView extends Vue {
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
$route!: RouteLocationNormalizedLoaded;
|
||||
$router!: Router;
|
||||
|
||||
accountIdentityStr: string = "null";
|
||||
activeDid = "";
|
||||
@@ -55,7 +57,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
|
||||
this.claimStr = (this.$route as Router).query["claim"];
|
||||
this.claimStr = (this.$route.query["claim"] as string) || "";
|
||||
if (this.claimStr) {
|
||||
try {
|
||||
const veriClaim = JSON.parse(this.claimStr);
|
||||
@@ -65,7 +67,7 @@ export default class ClaimAddRawView extends Vue {
|
||||
}
|
||||
} else {
|
||||
// there may be no link that uses this, meaning you'd have to enter it in a browser
|
||||
const claimJwtId = (this.$route as Router).query["claimJwtId"];
|
||||
const claimJwtId = (this.$route.query["claimJwtId"] as string) || "";
|
||||
if (claimJwtId) {
|
||||
const urlPath = libsUtil.isGlobalUri(claimJwtId)
|
||||
? "/api/claim/byHandle/"
|
||||
|
||||
Reference in New Issue
Block a user