forked from trent_larson/crowd-funder-for-time-pwa
fix error retrieving active DIDs; don't pop-up redundant toast warning when using current DID
This commit is contained in:
@@ -43,12 +43,6 @@ export const NOTIFY_CONFIRMATION_ERROR = {
|
|||||||
message: "There was a problem submitting the confirmation.",
|
message: "There was a problem submitting the confirmation.",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used in: [Component usage not yet documented]
|
|
||||||
export const NOTIFY_DEFAULT_TO_ACTIVE_DID = {
|
|
||||||
title: "Your Info",
|
|
||||||
message: "No user was specified so showing your info.",
|
|
||||||
};
|
|
||||||
|
|
||||||
// Used in: [Component usage not yet documented]
|
// Used in: [Component usage not yet documented]
|
||||||
export const NOTIFY_CONTACT_DELETED = {
|
export const NOTIFY_CONTACT_DELETED = {
|
||||||
title: "Deleted",
|
title: "Deleted",
|
||||||
|
|||||||
@@ -36,6 +36,11 @@ import { DEFAULT_ROOT_DERIVATION_PATH } from "./crypto";
|
|||||||
import { UNNAMED_PERSON } from "@/constants/entities";
|
import { UNNAMED_PERSON } from "@/constants/entities";
|
||||||
|
|
||||||
// Consolidate this with src/utils/PlatformServiceMixin.mapQueryResultToValues
|
// Consolidate this with src/utils/PlatformServiceMixin.mapQueryResultToValues
|
||||||
|
/**
|
||||||
|
* Translate DB query results into objects
|
||||||
|
* @param record is result of a database query
|
||||||
|
* @returns an array of objects (instead of nested arrays), each representing a row in the result
|
||||||
|
*/
|
||||||
function mapQueryResultToValues(
|
function mapQueryResultToValues(
|
||||||
record: { columns: string[]; values: unknown[][] } | undefined,
|
record: { columns: string[]; values: unknown[][] } | undefined,
|
||||||
): Array<Record<string, unknown>> {
|
): Array<Record<string, unknown>> {
|
||||||
@@ -575,7 +580,7 @@ export const retrieveAccountDids = async (): Promise<string[]> => {
|
|||||||
const platformService = await getPlatformService();
|
const platformService = await getPlatformService();
|
||||||
const dbAccounts = await platformService.dbQuery(`SELECT did FROM accounts`);
|
const dbAccounts = await platformService.dbQuery(`SELECT did FROM accounts`);
|
||||||
const allDids =
|
const allDids =
|
||||||
mapQueryResultToValues(dbAccounts)?.map((row) => row[0] as string) || [];
|
mapQueryResultToValues(dbAccounts)?.map((row) => row.did as string) || [];
|
||||||
return allDids;
|
return allDids;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -344,7 +344,6 @@ import { logger } from "../utils/logger";
|
|||||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||||
import {
|
import {
|
||||||
NOTIFY_DEFAULT_TO_ACTIVE_DID,
|
|
||||||
NOTIFY_CONTACT_DELETED,
|
NOTIFY_CONTACT_DELETED,
|
||||||
NOTIFY_CONTACT_DELETE_FAILED,
|
NOTIFY_CONTACT_DELETE_FAILED,
|
||||||
NOTIFY_REGISTRATION_SUCCESS,
|
NOTIFY_REGISTRATION_SUCCESS,
|
||||||
@@ -459,7 +458,6 @@ export default class DIDView extends Vue {
|
|||||||
if (!showDid) {
|
if (!showDid) {
|
||||||
// No DID provided in URL, use active DID
|
// No DID provided in URL, use active DID
|
||||||
showDid = this.activeDid;
|
showDid = this.activeDid;
|
||||||
this.notifyDefaultToActiveDID();
|
|
||||||
} else {
|
} else {
|
||||||
// DID provided in URL, validate it
|
// DID provided in URL, validate it
|
||||||
const decodedDid = decodeURIComponent(showDid);
|
const decodedDid = decodeURIComponent(showDid);
|
||||||
@@ -475,17 +473,6 @@ export default class DIDView extends Vue {
|
|||||||
this.viewingDid = showDid;
|
this.viewingDid = showDid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Notifies user that we're showing their DID info by default
|
|
||||||
*/
|
|
||||||
private notifyDefaultToActiveDID() {
|
|
||||||
this.notify.toast(
|
|
||||||
NOTIFY_DEFAULT_TO_ACTIVE_DID.title,
|
|
||||||
NOTIFY_DEFAULT_TO_ACTIVE_DID.message,
|
|
||||||
TIMEOUTS.SHORT,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads contact information for the viewing DID
|
* Loads contact information for the viewing DID
|
||||||
* Updates contact YAML representation if contact exists
|
* Updates contact YAML representation if contact exists
|
||||||
|
|||||||
Reference in New Issue
Block a user