|
@ -298,6 +298,7 @@ import { accessToken } from "@/libs/crypto"; |
|
|
import { AxiosError } from "axios/index"; |
|
|
import { AxiosError } from "axios/index"; |
|
|
import AlertMessage from "@/components/AlertMessage"; |
|
|
import AlertMessage from "@/components/AlertMessage"; |
|
|
import QuickNav from "@/components/QuickNav"; |
|
|
import QuickNav from "@/components/QuickNav"; |
|
|
|
|
|
import { IIdentifier } from "@veramo/core"; |
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires |
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires |
|
|
const Buffer = require("buffer/").Buffer; |
|
|
const Buffer = require("buffer/").Buffer; |
|
@ -336,12 +337,6 @@ export default class AccountViewView extends Vue { |
|
|
.equals(activeDid) |
|
|
.equals(activeDid) |
|
|
.first(); |
|
|
.first(); |
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
|
|
|
|
|
|
if (!identity) { |
|
|
|
|
|
throw new Error( |
|
|
|
|
|
"Attempted to load Give records with no identity available.", |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
return identity; |
|
|
return identity; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -395,14 +390,18 @@ export default class AccountViewView extends Vue { |
|
|
|
|
|
|
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
|
|
|
|
|
|
|
|
|
if (identity) { |
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); |
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString( |
|
|
|
|
|
"base64", |
|
|
|
|
|
); |
|
|
this.derivationPath = identity.keys[0].meta.derivationPath; |
|
|
this.derivationPath = identity.keys[0].meta.derivationPath; |
|
|
|
|
|
|
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
activeDid: identity.did, |
|
|
activeDid: identity.did, |
|
|
}); |
|
|
}); |
|
|
this.checkLimits(); |
|
|
this.checkLimitsFor(identity); |
|
|
|
|
|
} |
|
|
} catch (err) { |
|
|
} catch (err) { |
|
|
if ( |
|
|
if ( |
|
|
err.message === |
|
|
err.message === |
|
@ -461,12 +460,18 @@ export default class AccountViewView extends Vue { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async checkLimits() { |
|
|
async checkLimits() { |
|
|
|
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
|
|
|
if (identity) { |
|
|
|
|
|
this.checkLimitsFor(identity); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async checkLimitsFor(identity: IIdentifier) { |
|
|
this.loadingLimits = true; |
|
|
this.loadingLimits = true; |
|
|
this.limitsMessage = ""; |
|
|
this.limitsMessage = ""; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
const url = this.apiServer + "/api/report/rateLimits"; |
|
|
const url = this.apiServer + "/api/report/rateLimits"; |
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
|
|
|
const headers = await this.getHeaders(identity); |
|
|
const headers = await this.getHeaders(identity); |
|
|
|
|
|
|
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
const resp = await this.axios.get(url, { headers }); |
|
|