Browse Source

Cleaned up messages and improved the accountsDB lookups

kb/add-usage-guide
Matthew Raymer 1 year ago
parent
commit
3471afdf25
  1. 17
      src/views/AccountViewView.vue
  2. 2
      src/views/ProjectViewView.vue

17
src/views/AccountViewView.vue

@ -274,7 +274,6 @@
<script lang="ts">
import "dexie-export-import";
import * as R from "ramda";
import { Component, Vue } from "vue-facing-decorator";
import { useClipboard } from "@vueuse/core";
@ -324,8 +323,10 @@ export default class AccountViewView extends Vue {
public async getIdentity(activeDid) {
await accountsDB.open();
const accounts = await accountsDB.accounts.toArray();
const account = R.find((acc) => acc.did === activeDid, accounts);
const account = await accountsDB.accounts
.where("did")
.equals(activeDid)
.first();
const identity = JSON.parse(account?.identity || "null");
if (!identity) {
@ -362,14 +363,10 @@ export default class AccountViewView extends Vue {
return timeStr.substring(0, timeStr.indexOf("T"));
}
async initializeCount() {
this.numAccounts = await this.accounts.count();
}
async mounted() {
async beforeCreate() {
accountsDB.open();
this.accounts = accountsDB.accounts;
await this.initializeCount();
this.numAccounts = await this.accounts.count();
}
async created() {
@ -402,7 +399,7 @@ export default class AccountViewView extends Vue {
} catch (err) {
if (
err.message ===
"Attempted to load Give records with no identity available."
"Attempted to load account records with no identity available."
) {
this.limitsMessage = "No identity.";
this.loadingLimits = false;

2
src/views/ProjectViewView.vue

@ -184,7 +184,7 @@ export default class ProjectViewView extends Vue {
if (!identity) {
throw new Error(
"Attempted to load Give records with no identity available.",
"Attempted to load project records with no identity available.",
);
}
return identity;

Loading…
Cancel
Save