fix many, many more type errors

This commit is contained in:
2023-09-03 10:02:17 -06:00
parent b8aaffbf8d
commit b05b602acd
15 changed files with 170 additions and 97 deletions

View File

@@ -86,11 +86,17 @@ import { db, accountsDB } from "@/db";
import { AccountsSchema } from "@/db/tables/accounts";
import { MASTER_SETTINGS_KEY } from "@/db/tables/settings";
import { accessToken } from "@/libs/crypto";
import { createAndSubmitGive } from "@/libs/endorserServer";
import {
createAndSubmitGive,
GiverInputInfo,
GiverOutputInfo,
} from "@/libs/endorserServer";
import { Account } from "@/db/tables/accounts";
import { Contact } from "@/db/tables/contacts";
import QuickNav from "@/components/QuickNav";
import EntityIcon from "@/components/EntityIcon";
import { IIdentifier } from "@veramo/core";
import { RawAxiosRequestHeaders } from "axios";
interface Notification {
group: string;
@@ -109,8 +115,9 @@ export default class HomeView extends Vue {
allAccounts: Array<Account> = [];
allContacts: Array<Contact> = [];
apiServer = "";
feedLastViewedId = "";
isHiddenSpinner = true;
accounts: AccountsSchema;
accounts: typeof AccountsSchema;
numAccounts = 0;
async beforeCreate() {
@@ -119,7 +126,7 @@ export default class HomeView extends Vue {
this.numAccounts = await this.accounts.count();
}
public async getIdentity(activeDid) {
public async getIdentity(activeDid: string) {
await accountsDB.open();
const account = await accountsDB.accounts
.where("did")
@@ -135,7 +142,7 @@ export default class HomeView extends Vue {
return identity;
}
public async getHeaders(identity) {
public async getHeaders(identity: IIdentifier) {
const token = await accessToken(identity);
const headers = {
"Content-Type": "application/json",
@@ -171,7 +178,9 @@ export default class HomeView extends Vue {
}
public async buildHeaders() {
const headers = { "Content-Type": "application/json" };
const headers: RawAxiosRequestHeaders = {
"Content-Type": "application/json",
};
if (this.activeDid) {
await accountsDB.open();
@@ -192,11 +201,11 @@ export default class HomeView extends Vue {
return headers;
}
openDialog(giver) {
openDialog(giver: GiverInputInfo) {
this.$refs.customDialog.open(giver);
}
handleDialogResult(result) {
handleDialogResult(result: GiverOutputInfo) {
if (result.action === "confirm") {
return new Promise((resolve) => {
this.recordGive(result.contact?.did, result.description, result.hours);
@@ -213,7 +222,11 @@ export default class HomeView extends Vue {
* @param description may be an empty string
* @param hours may be 0
*/
public async recordGive(giverDid, description, hours) {
public async recordGive(
giverDid?: string,
description?: string,
hours?: number,
) {
if (!this.activeDid) {
this.$notify(
{
@@ -252,8 +265,8 @@ export default class HomeView extends Vue {
hours,
);
if (isGiveCreationError(result)) {
const errorMessage = getGiveCreationErrorMessage(result);
if (this.isGiveCreationError(result)) {
const errorMessage = this.getGiveCreationErrorMessage(result);
console.log("Error with give result:", result);
this.$notify(
{
@@ -283,7 +296,7 @@ export default class HomeView extends Vue {
type: "danger",
title: "Error",
text:
getGiveErrorMessage(error) ||
this.getGiveErrorMessage(error) ||
"There was an error recording the give.",
},
-1,