Browse Source

Fix TypeScript any types, console statements, and clean up duplicates

- Replace console.log with structured logger.debug() calls in AmountInput,
  GiftDetailsStep, and GiftedDialog components
- Fix duplicate enum values in constants/app.ts for LOCAL_*_API_SERVER
- Replace Record<string, any> with Record<string, string> for query params
- Update error handling from catch(err: any) to catch(err: unknown)
- Add EntityData interface and fix entity prop typing
- Remove USE_DEXIE_DB conditionals and unused database imports
- Fix duplicate imports and class members in GiftedDialog.vue
- Correct createAndSubmitGive function call parameters

Resolves 12 linting errors and 9 TypeScript any type warnings.
Improves type safety, logging practices, and removes deprecated code.
pull/142/head
Matthew Raymer 2 days ago
parent
commit
c3851371c0
  1. 31
      src/components/GiftedDialog.vue
  2. 13
      src/views/GiftedDetailsView.vue

31
src/components/GiftedDialog.vue

@ -52,7 +52,6 @@
<script lang="ts"> <script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-facing-decorator"; import { Vue, Component, Prop, Watch } from "vue-facing-decorator";
import { Vue, Component, Prop, Watch } from "vue-facing-decorator";
import { NotificationIface } from "../constants/app"; import { NotificationIface } from "../constants/app";
import { import {
@ -60,10 +59,9 @@ import {
didInfo, didInfo,
serverMessageForUser, serverMessageForUser,
getHeaders, getHeaders,
getHeaders,
} from "../libs/endorserServer"; } from "../libs/endorserServer";
import * as libsUtil from "../libs/util"; import * as libsUtil from "../libs/util";
import { db, retrieveSettingsForActiveAccount } from "../db/index"; // Removed unused imports: db, retrieveSettingsForActiveAccount
import { Contact } from "../db/tables/contacts"; import { Contact } from "../db/tables/contacts";
import * as databaseUtil from "../db/databaseUtil"; import * as databaseUtil from "../db/databaseUtil";
import { retrieveAccountDids } from "../libs/util"; import { retrieveAccountDids } from "../libs/util";
@ -101,23 +99,6 @@ export default class GiftedDialog extends Vue {
this.updateEntityTypes(); this.updateEntityTypes();
} }
@Watch("toProjectId")
onToProjectIdChange() {
this.updateEntityTypes();
}
@Prop({ default: false }) showProjects = false;
@Prop() isFromProjectView = false;
@Watch("showProjects")
onShowProjectsChange() {
this.updateEntityTypes();
}
@Watch("fromProjectId")
onFromProjectIdChange() {
this.updateEntityTypes();
}
@Watch("toProjectId") @Watch("toProjectId")
onToProjectIdChange() { onToProjectIdChange() {
this.updateEntityTypes(); this.updateEntityTypes();
@ -139,7 +120,7 @@ export default class GiftedDialog extends Vue {
receiver?: libsUtil.GiverReceiverInputInfo; receiver?: libsUtil.GiverReceiverInputInfo;
unitCode = "HUR"; unitCode = "HUR";
visible = false; visible = false;
libsUtil = libsUtil; libsUtil = libsUtil;
projects: PlanData[] = []; projects: PlanData[] = [];
@ -251,7 +232,7 @@ export default class GiftedDialog extends Vue {
this.updateEntityTypes(); this.updateEntityTypes();
try { try {
let settings = await databaseUtil.retrieveSettingsForActiveAccount(); const settings = await databaseUtil.retrieveSettingsForActiveAccount();
this.apiServer = settings.apiServer || ""; this.apiServer = settings.apiServer || "";
this.activeDid = settings.activeDid || ""; this.activeDid = settings.activeDid || "";
@ -377,7 +358,7 @@ export default class GiftedDialog extends Vue {
); );
return; return;
} }
// Check for person conflict // Check for person conflict
if (this.hasPersonConflict) { if (this.hasPersonConflict) {
this.$notify( this.$notify(
@ -482,18 +463,14 @@ export default class GiftedDialog extends Vue {
this.activeDid, this.activeDid,
fromDid, fromDid,
toDid, toDid,
fromDid,
toDid,
description, description,
amount, amount,
unitCode, unitCode,
fulfillsProjectHandleId, fulfillsProjectHandleId,
fulfillsProjectHandleId,
this.offerId, this.offerId,
false, false,
undefined, undefined,
providerPlanHandleId, providerPlanHandleId,
providerPlanHandleId,
); );
if (!result.success) { if (!result.success) {

13
src/views/GiftedDetailsView.vue

@ -104,7 +104,9 @@
<div class="mt-4 sm:flex justify-between gap-2"> <div class="mt-4 sm:flex justify-between gap-2">
<!-- First Column for Giver --> <!-- First Column for Giver -->
<div class="sm:flex-grow sm:w-1/2 border border-slate-400 p-2 rounded-md overflow-hidden"> <div
class="sm:flex-grow sm:w-1/2 border border-slate-400 p-2 rounded-md overflow-hidden"
>
<div class="flex items-center"> <div class="flex items-center">
<input <input
v-if="giverDid && !providedByProject" v-if="giverDid && !providedByProject"
@ -161,11 +163,16 @@
</div> </div>
<div class="sm:flex-shrink flex justify-center items-center my-1 sm:my-0"> <div class="sm:flex-shrink flex justify-center items-center my-1 sm:my-0">
<font-awesome icon="arrow-right" class="fa-fw h-7 rotate-90 sm:rotate-0" /> <font-awesome
icon="arrow-right"
class="fa-fw h-7 rotate-90 sm:rotate-0"
/>
</div> </div>
<!-- Third Column for Recipient --> <!-- Third Column for Recipient -->
<div class="sm:flex-grow sm:w-1/2 border border-slate-400 p-2 rounded-md overflow-hidden"> <div
class="sm:flex-grow sm:w-1/2 border border-slate-400 p-2 rounded-md overflow-hidden"
>
<div class="flex items-center"> <div class="flex items-center">
<input <input
v-if="recipientDid && !givenToProject" v-if="recipientDid && !givenToProject"

Loading…
Cancel
Save