forked from jsnbuchanan/crowd-funder-for-time-pwa
Fix typing errors from the refactoring
This commit is contained in:
@@ -287,7 +287,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { AxiosError } from "axios/index";
|
||||
import { AxiosError } from "axios";
|
||||
import "dexie-export-import";
|
||||
import { Component, Vue } from "vue-facing-decorator";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
@@ -313,7 +313,7 @@ interface Notification {
|
||||
interface IAccount {
|
||||
did: string;
|
||||
publicKeyHex: string;
|
||||
privateHex: string;
|
||||
privateHex?: string;
|
||||
derivationPath: string;
|
||||
}
|
||||
|
||||
@@ -471,15 +471,24 @@ export default class AccountViewView extends Vue {
|
||||
* Processes the identity and updates the component's state.
|
||||
* @param {IdentityType} identity - Object containing identity information.
|
||||
*/
|
||||
processIdentity(identity: IdentityType) {
|
||||
this.publicHex = identity.keys[0].publicKeyHex;
|
||||
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64");
|
||||
this.derivationPath = identity.keys[0].meta.derivationPath;
|
||||
processIdentity(identity: IIdentifier) {
|
||||
if (
|
||||
identity &&
|
||||
identity.keys &&
|
||||
identity.keys.length > 0 &&
|
||||
identity.keys[0].meta
|
||||
) {
|
||||
this.publicHex = identity.keys[0].publicKeyHex;
|
||||
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64");
|
||||
this.derivationPath = identity.keys[0].meta.derivationPath;
|
||||
|
||||
db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
activeDid: identity.did,
|
||||
});
|
||||
this.checkLimitsFor(identity);
|
||||
db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
activeDid: identity.did,
|
||||
});
|
||||
this.checkLimitsFor(identity);
|
||||
} else {
|
||||
// Handle the case where any of these are null or undefined
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -488,8 +497,9 @@ export default class AccountViewView extends Vue {
|
||||
*/
|
||||
handleError(err: unknown) {
|
||||
if (
|
||||
err instanceof Error &&
|
||||
err.message ===
|
||||
"Attempted to load account records with no identity available."
|
||||
"Attempted to load account records with no identity available."
|
||||
) {
|
||||
this.limitsMessage = "No identity.";
|
||||
this.loadingLimits = false;
|
||||
@@ -665,16 +675,19 @@ export default class AccountViewView extends Vue {
|
||||
*
|
||||
* @param {AxiosError | Error} error - The error object.
|
||||
*/
|
||||
private handleRateLimitsError(error: AxiosError | Error) {
|
||||
private handleRateLimitsError(error: unknown) {
|
||||
if (error instanceof AxiosError) {
|
||||
const data = error.response?.data as ErrorResponse;
|
||||
this.limitsMessage = data?.error?.message || "Bad server response.";
|
||||
console.error("Bad response retrieving limits:", error);
|
||||
} else if (
|
||||
error instanceof Error &&
|
||||
error.message ===
|
||||
"Attempted to load Give records with no identity available."
|
||||
"Attempted to load Give records with no identity available."
|
||||
) {
|
||||
this.limitsMessage = "No identity.";
|
||||
} else {
|
||||
// Handle other unknown errors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user