From b514d640682a0a3708a93b339bfe69fa8e816ce8 Mon Sep 17 00:00:00 2001 From: Matthew Aaron Raymer Date: Sat, 2 Sep 2023 18:15:30 +0800 Subject: [PATCH] Type fixes --- src/views/ProjectViewView.vue | 35 ++++++++++++++++------------------ src/views/SeedBackupView.vue | 11 ++++------- src/views/StatisticsView.vue | 36 ++++++++++++++++++----------------- 3 files changed, 39 insertions(+), 43 deletions(-) diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 740ac08..3e3d6e1 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -223,17 +223,14 @@ import { didInfo, GiveServerRecord, } from "@/libs/endorserServer"; -import AlertMessage from "@/components/AlertMessage"; import QuickNav from "@/components/QuickNav"; import EntityIcon from "@/components/EntityIcon"; @Component({ - components: { GiftedDialog, AlertMessage, QuickNav, EntityIcon }, + components: { GiftedDialog, QuickNav, EntityIcon }, }) export default class ProjectViewView extends Vue { activeDid = ""; - alertMessage = ""; - alertTitle = ""; allMyDids: Array = []; allContacts: Array = []; apiServer = ""; @@ -342,7 +339,7 @@ export default class ProjectViewView extends Vue { this.longitude = resp.data.claim?.location?.geo?.longitude || 0; } else if (resp.status === 404) { // actually, axios throws an error so we never get here - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -355,7 +352,7 @@ export default class ProjectViewView extends Vue { } catch (error: unknown) { const serverError = error as AxiosError; if (serverError.response?.status === 404) { - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -365,7 +362,7 @@ export default class ProjectViewView extends Vue { -1, ); } else { - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -387,7 +384,7 @@ export default class ProjectViewView extends Vue { if (resp.status === 200 && resp.data.data) { this.givesToThis = resp.data.data; } else { - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -399,7 +396,7 @@ export default class ProjectViewView extends Vue { } } catch (error: unknown) { const serverError = error as AxiosError; - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -423,7 +420,7 @@ export default class ProjectViewView extends Vue { if (resp.status === 200 && resp.data.data) { this.givesByThis = resp.data.data; } else { - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -435,7 +432,7 @@ export default class ProjectViewView extends Vue { } } catch (error: unknown) { const serverError = error as AxiosError; - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -486,9 +483,9 @@ export default class ProjectViewView extends Vue { * @param description may be an empty string * @param hours may be 0 */ - async recordGive(giverDid, description, hours) { + async recordGive(giverDid, description: string, hours: number) { if (!this.activeDid) { - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -501,7 +498,7 @@ export default class ProjectViewView extends Vue { } if (!description && !hours) { - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -528,7 +525,7 @@ export default class ProjectViewView extends Vue { if (result.status !== 201 || result.data?.error) { console.log("Error with give result:", result); - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", @@ -540,7 +537,7 @@ export default class ProjectViewView extends Vue { -1, ); } else { - this.$notify( + (this as any).$notify( { group: "alert", type: "success", @@ -552,14 +549,14 @@ export default class ProjectViewView extends Vue { } } catch (e) { console.log("Error with give caught:", e); - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", title: "Error", text: - e.userMessage || - e.response?.data?.error?.message || + e?.userMessage || + e?.response?.data?.error?.message || "There was an error recording the give.", }, -1, diff --git a/src/views/SeedBackupView.vue b/src/views/SeedBackupView.vue index 2912aee..9e720eb 100644 --- a/src/views/SeedBackupView.vue +++ b/src/views/SeedBackupView.vue @@ -62,16 +62,13 @@ import { Component, Vue } from "vue-facing-decorator"; import { accountsDB, db } from "@/db"; import * as R from "ramda"; import { MASTER_SETTINGS_KEY } from "@/db/tables/settings"; -import AlertMessage from "@/components/AlertMessage"; -import QuickNav from "@/components/QuickNav"; +import QuickNav from "@/components/QuickNav.vue"; -@Component({ components: { AlertMessage, QuickNav } }) +@Component({ components: { QuickNav } }) export default class SeedBackupView extends Vue { activeAccount = null; numAccounts = 0; showSeed = false; - alertMessage = ""; - alertTitle = ""; // 'created' hook runs when the Vue instance is first created async created() { @@ -84,9 +81,9 @@ export default class SeedBackupView extends Vue { const accounts = await accountsDB.accounts.toArray(); this.numAccounts = accounts.length; this.activeAccount = R.find((acc) => acc.did === activeDid, accounts); - } catch (err) { + } catch (err: unknown) { console.error("Got an error loading an identity:", err); - this.$notify( + (this as any).$notify( { group: "alert", type: "danger", diff --git a/src/views/StatisticsView.vue b/src/views/StatisticsView.vue index 0c2c7d6..b730c28 100644 --- a/src/views/StatisticsView.vue +++ b/src/views/StatisticsView.vue @@ -34,25 +34,26 @@
-