forked from trent_larson/crowd-funder-for-time-pwa
Cleaned up messages and improved the accountsDB lookups
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user