@ -170,6 +170,7 @@ import { logger } from "../utils/logger";
/ / N o l o n g e r n e e d e d - u s i n g P l a t f o r m S e r v i c e M i x i n m e t h o d s
/ / N o l o n g e r n e e d e d - u s i n g P l a t f o r m S e r v i c e M i x i n m e t h o d s
/ / i m p o r t { P l a t f o r m S e r v i c e F a c t o r y } f r o m " @ / s e r v i c e s / P l a t f o r m S e r v i c e F a c t o r y " ;
/ / i m p o r t { P l a t f o r m S e r v i c e F a c t o r y } f r o m " @ / s e r v i c e s / P l a t f o r m S e r v i c e F a c t o r y " ;
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin" ;
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin" ;
import { isDatabaseError } from "@/interfaces/common" ;
import { createNotifyHelpers , TIMEOUTS } from "@/utils/notify" ;
import { createNotifyHelpers , TIMEOUTS } from "@/utils/notify" ;
import { APP_SERVER } from "@/constants/app" ;
import { APP_SERVER } from "@/constants/app" ;
import {
import {
@ -376,7 +377,11 @@ export default class ContactsView extends Vue {
"" ,
"" ,
async ( name ) => {
async ( name ) => {
await this . addContact ( {
await this . addContact ( {
did : ( registration . vc . credentialSubject . agent as any ) . identifier ,
did : (
registration . vc . credentialSubject . agent as {
identifier : string ;
}
) . identifier ,
name : name ,
name : name ,
registered : true ,
registered : true ,
} ) ;
} ) ;
@ -387,7 +392,11 @@ export default class ContactsView extends Vue {
async ( ) => {
async ( ) => {
/ / o n c a n c e l , w i l l s t i l l a d d t h e c o n t a c t
/ / o n c a n c e l , w i l l s t i l l a d d t h e c o n t a c t
await this . addContact ( {
await this . addContact ( {
did : ( registration . vc . credentialSubject . agent as any ) . identifier ,
did : (
registration . vc . credentialSubject . agent as {
identifier : string ;
}
) . identifier ,
name : "(person who invited you)" ,
name : "(person who invited you)" ,
registered : true ,
registered : true ,
} ) ;
} ) ;
@ -396,8 +405,7 @@ export default class ContactsView extends Vue {
this . showOnboardingInfo ( ) ;
this . showOnboardingInfo ( ) ;
} ,
} ,
) ;
) ;
/ / e s l i n t - d i s a b l e - n e x t - l i n e @ t y p e s c r i p t - e s l i n t / n o - e x p l i c i t - a n y
} catch ( error : unknown ) {
} catch ( error : any ) {
const fullError = "Error redeeming invite: " + errorStringForLog ( error ) ;
const fullError = "Error redeeming invite: " + errorStringForLog ( error ) ;
this . $logAndConsole ( fullError , true ) ;
this . $logAndConsole ( fullError , true ) ;
let message = "Got an error sending the invite." ;
let message = "Got an error sending the invite." ;
@ -881,20 +889,21 @@ export default class ContactsView extends Vue {
/ * *
/ * *
* Handle errors during contact addition
* Handle errors during contact addition
* /
* /
private handleContactAddError ( err : any ) : void {
private handleContactAddError ( err : unknown ) : void {
const fullError =
const fullError =
"Error when adding contact to storage: " + errorStringForLog ( err ) ;
"Error when adding contact to storage: " + errorStringForLog ( err ) ;
this . $logAndConsole ( fullError , true ) ;
this . $logAndConsole ( fullError , true ) ;
let message = NOTIFY_CONTACT_IMPORT_ERROR . message ;
let message = NOTIFY_CONTACT_IMPORT_ERROR . message ;
if (
( err as any ) . message ? . indexOf ( "Key already exists in the object store." ) >
/ / U s e t y p e - s a f e e r r o r c h e c k i n g w i t h o u r n e w t y p e g u a r d s
- 1
if ( isDatabaseError ( err ) ) {
) {
if ( err . message . includes ( "Key already exists in the object store" ) ) {
message = NOTIFY_CONTACT_IMPORT_CONFLICT . message ;
message = NOTIFY_CONTACT_IMPORT_CONFLICT . message ;
}
}
if ( ( err as any ) . name === "ConstraintError" ) {
if ( err . name === "ConstraintError" ) {
message += " " + NOTIFY_CONTACT_IMPORT_CONSTRAINT . message ;
message += " " + NOTIFY_CONTACT_IMPORT_CONSTRAINT . message ;
}
}
}
this . notify . error ( message , TIMEOUTS . LONG ) ;
this . notify . error ( message , TIMEOUTS . LONG ) ;