forked from jsnbuchanan/crowd-funder-for-time-pwa
catch more errors if something catastrophic happens to encrypted data
This commit is contained in:
@@ -389,6 +389,7 @@ import {
|
||||
} from "@/constants/app";
|
||||
import {
|
||||
db,
|
||||
logConsoleAndDb,
|
||||
retrieveSettingsForActiveAccount,
|
||||
updateAccountSettings,
|
||||
} from "@/db/index";
|
||||
@@ -486,12 +487,21 @@ export default class HomeView extends Vue {
|
||||
|
||||
async mounted() {
|
||||
try {
|
||||
this.allMyDids = await retrieveAccountDids();
|
||||
if (this.allMyDids.length === 0) {
|
||||
this.isCreatingIdentifier = true;
|
||||
const newDid = await generateSaveAndActivateIdentity();
|
||||
this.isCreatingIdentifier = false;
|
||||
this.allMyDids = [newDid];
|
||||
try {
|
||||
this.allMyDids = await retrieveAccountDids();
|
||||
if (this.allMyDids.length === 0) {
|
||||
this.isCreatingIdentifier = true;
|
||||
const newDid = await generateSaveAndActivateIdentity();
|
||||
this.isCreatingIdentifier = false;
|
||||
this.allMyDids = [newDid];
|
||||
}
|
||||
} catch (error) {
|
||||
// continue because we want the feed to work, even anonymously
|
||||
logConsoleAndDb(
|
||||
"Error retrieving all account DIDs on home page:" + error,
|
||||
true,
|
||||
);
|
||||
// some other piece will display an error about personal info
|
||||
}
|
||||
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
@@ -546,6 +556,7 @@ export default class HomeView extends Vue {
|
||||
this.activeDid,
|
||||
this.lastAckedOfferToUserJwtId,
|
||||
);
|
||||
console.log("offersToUserData", offersToUserData);
|
||||
this.numNewOffersToUser = offersToUserData.data.length;
|
||||
this.newOffersToUserHitLimit = offersToUserData.hitLimit;
|
||||
}
|
||||
@@ -563,7 +574,7 @@ export default class HomeView extends Vue {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (err: any) {
|
||||
console.error("Error retrieving settings or feed.", err);
|
||||
logConsoleAndDb("Error retrieving settings or feed: " + err, true);
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
@@ -760,13 +771,19 @@ export default class HomeView extends Vue {
|
||||
*/
|
||||
async retrieveGives(endorserApiServer: string, beforeId?: string) {
|
||||
const beforeQuery = beforeId == null ? "" : "&beforeId=" + beforeId;
|
||||
const doNotShowErrorAgain = !!beforeId; // don't show error again if we're loading more
|
||||
const headers = await getHeaders(
|
||||
this.activeDid,
|
||||
doNotShowErrorAgain ? undefined : this.$notify,
|
||||
);
|
||||
// retrieve headers for this user, but if an error happens then report it but proceed with the fetch with no header
|
||||
const response = await fetch(
|
||||
endorserApiServer +
|
||||
"/api/v2/report/gives?giftNotTrade=true" +
|
||||
beforeQuery,
|
||||
{
|
||||
method: "GET",
|
||||
headers: await getHeaders(this.activeDid),
|
||||
headers: headers,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user