forked from trent_larson/crowd-funder-for-time-pwa
Fix duplicate export declarations and migrate ContactsView with sub-components
- Remove duplicate NOTIFY_INVITE_MISSING and NOTIFY_INVITE_PROCESSING_ERROR exports - Update InviteOneAcceptView.vue to use correct NOTIFY_INVITE_TRUNCATED_DATA constant - Migrate ContactsView to PlatformServiceMixin and extract into modular sub-components - Resolves TypeScript compilation errors preventing web build
This commit is contained in:
@@ -42,14 +42,19 @@ import { Component, Vue } from "vue-facing-decorator";
|
||||
import { Router, RouteLocationNormalized } from "vue-router";
|
||||
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import { APP_SERVER, NotificationIface } from "../constants/app";
|
||||
import {
|
||||
logConsoleAndDb,
|
||||
} from "../db/index";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import { APP_SERVER } from "../constants/app";
|
||||
import { decodeEndorserJwt } from "../libs/crypto/vc";
|
||||
import { errorStringForLog } from "../libs/endorserServer";
|
||||
import { generateSaveAndActivateIdentity } from "../libs/util";
|
||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers } from "@/utils/notify";
|
||||
import {
|
||||
NOTIFY_INVITE_MISSING,
|
||||
NOTIFY_INVITE_PROCESSING_ERROR,
|
||||
NOTIFY_INVITE_TRUNCATED_DATA,
|
||||
INVITE_TIMEOUT_STANDARD,
|
||||
INVITE_TIMEOUT_LONG,
|
||||
} from "@/constants/notifications";
|
||||
|
||||
/**
|
||||
* Invite One Accept View Component
|
||||
@@ -78,10 +83,11 @@ import { generateSaveAndActivateIdentity } from "../libs/util";
|
||||
*/
|
||||
@Component({
|
||||
components: { QuickNav },
|
||||
mixins: [PlatformServiceMixin],
|
||||
})
|
||||
export default class InviteOneAcceptView extends Vue {
|
||||
/** Notification function injected by Vue */
|
||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||
/** Notification helpers */
|
||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||
/** Router instance for navigation */
|
||||
$router!: Router;
|
||||
/** Route instance for current route */
|
||||
@@ -113,7 +119,7 @@ export default class InviteOneAcceptView extends Vue {
|
||||
this.checkingInvite = true;
|
||||
|
||||
// Load or generate identity
|
||||
let settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
const settings = await this.$accountSettings();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
|
||||
@@ -122,7 +128,10 @@ export default class InviteOneAcceptView extends Vue {
|
||||
}
|
||||
|
||||
// Extract JWT from route path
|
||||
const jwt = (this.$route.params.jwt as string) || this.$route.query.jwt as string || "";
|
||||
const jwt =
|
||||
(this.$route.params.jwt as string) ||
|
||||
(this.$route.query.jwt as string) ||
|
||||
"";
|
||||
await this.processInvite(jwt, false);
|
||||
|
||||
this.checkingInvite = false;
|
||||
@@ -224,15 +233,7 @@ export default class InviteOneAcceptView extends Vue {
|
||||
*/
|
||||
private handleMissingJwt(notify: boolean) {
|
||||
if (notify) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Missing Invite",
|
||||
text: "There was no invite. Paste the entire text that has the data.",
|
||||
},
|
||||
5000,
|
||||
);
|
||||
this.notify.error(NOTIFY_INVITE_MISSING.message, INVITE_TIMEOUT_LONG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,17 +244,12 @@ export default class InviteOneAcceptView extends Vue {
|
||||
*/
|
||||
private handleError(error: unknown, notify: boolean) {
|
||||
const fullError = "Error accepting invite: " + errorStringForLog(error);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
|
||||
if (notify) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "There was an error processing that invite.",
|
||||
},
|
||||
3000,
|
||||
this.notify.error(
|
||||
NOTIFY_INVITE_PROCESSING_ERROR.message,
|
||||
INVITE_TIMEOUT_STANDARD,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -277,14 +273,9 @@ export default class InviteOneAcceptView extends Vue {
|
||||
jwtInput.endsWith("invite-one-accept") ||
|
||||
jwtInput.endsWith("invite-one-accept/")
|
||||
) {
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Error",
|
||||
text: "That is only part of the invite data; it's missing some at the end. Try another way to get the full data.",
|
||||
},
|
||||
5000,
|
||||
this.notify.error(
|
||||
NOTIFY_INVITE_TRUNCATED_DATA.message,
|
||||
INVITE_TIMEOUT_LONG,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user