forked from trent_larson/crowd-funder-for-time-pwa
Complete ContactsView.vue Enhanced Triple Migration Pattern (2 minutes)
Phase 1 - Database Migration: ✅ Already using PlatformServiceMixin Phase 2 - SQL Abstraction: ✅ Already using service methods Phase 3 - Notification Migration: ✅ Appropriately incomplete (3 complex modals) Phase 4 - Legacy Logging Migration: ✅ Replaced 7 logConsoleAndDb calls Changes made: - Removed legacy logConsoleAndDb import - Replaced 7 logConsoleAndDb() calls with this.$logAndConsole() - Maintained 3 complex modal $notify() calls (appropriately incomplete) - All notification constants already properly imported and used Complex modals preserved (cannot use helper methods): - Contact registration prompt with stopAsking functionality - Unconfirmed hours confirmation with custom callbacks - Onboarding meeting dialog with custom button text Validation results: - Mixed pattern files: 2 → 1 (improvement) - logConsoleAndDb imports: 15 → 14 (improvement) - Linting: ✅ Passed (0 errors, 8 warnings) - TypeScript: ✅ Compiles successfully Security: Eliminates legacy logging patterns, maintains proper abstraction Performance: Uses mixin caching and optimized logging Documentation: Follows established migration patterns
This commit is contained in:
@@ -275,7 +275,7 @@ import OfferDialog from "../components/OfferDialog.vue";
|
||||
import ContactNameDialog from "../components/ContactNameDialog.vue";
|
||||
import TopMessage from "../components/TopMessage.vue";
|
||||
import { APP_SERVER, AppString, NotificationIface } from "../constants/app";
|
||||
import { logConsoleAndDb } from "../db/index";
|
||||
// Removed legacy logging import - migrated to PlatformServiceMixin
|
||||
import { Contact } from "../db/tables/contacts";
|
||||
// Removed unused import: databaseUtil - migrated to PlatformServiceMixin
|
||||
import { getContactJwtFromJwtUrl } from "../libs/crypto";
|
||||
@@ -688,7 +688,7 @@ export default class ContactsView extends Vue {
|
||||
this.givenToMeUnconfirmed = givenToMeUnconfirmed;
|
||||
} catch (error) {
|
||||
const fullError = "Error loading gives: " + errorStringForLog(error);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
this.notify.error("Got an error loading your gives.", TIMEOUTS.STANDARD);
|
||||
}
|
||||
}
|
||||
@@ -764,7 +764,7 @@ export default class ContactsView extends Vue {
|
||||
} catch (e) {
|
||||
const fullError =
|
||||
"Error adding contacts from CSV: " + errorStringForLog(e);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
this.danger("An error occurred. Some contacts may have been added.");
|
||||
}
|
||||
|
||||
@@ -829,7 +829,7 @@ export default class ContactsView extends Vue {
|
||||
} catch (e) {
|
||||
const fullError =
|
||||
"Error adding contacts from array: " + errorStringForLog(e);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
this.danger("The input could not be parsed.", "Invalid Contact List");
|
||||
}
|
||||
return;
|
||||
@@ -917,7 +917,7 @@ export default class ContactsView extends Vue {
|
||||
.catch((err) => {
|
||||
const fullError =
|
||||
"Error when adding contact to storage: " + errorStringForLog(err);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
let message = "An error prevented this import.";
|
||||
if (
|
||||
err.message?.indexOf("Key already exists in the object store.") > -1
|
||||
@@ -960,7 +960,7 @@ export default class ContactsView extends Vue {
|
||||
}
|
||||
} catch (error) {
|
||||
const fullError = "Error when registering: " + errorStringForLog(error);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
let userMessage = "There was an error.";
|
||||
const serverError = error as AxiosError;
|
||||
if (serverError.isAxiosError) {
|
||||
@@ -1121,7 +1121,7 @@ export default class ContactsView extends Vue {
|
||||
} catch (err) {
|
||||
const fullError =
|
||||
"Error updating contact-amounts setting: " + errorStringForLog(err);
|
||||
logConsoleAndDb(fullError, true);
|
||||
this.$logAndConsole(fullError, true);
|
||||
this.notify.error(
|
||||
"The setting may not have saved. Try again, maybe after restarting the app.",
|
||||
TIMEOUTS.LONG,
|
||||
@@ -1252,8 +1252,9 @@ export default class ContactsView extends Vue {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
logConsoleAndDb(
|
||||
this.$logAndConsole(
|
||||
"Error checking meeting status:" + errorStringForLog(error),
|
||||
true,
|
||||
);
|
||||
this.danger(
|
||||
"There was an error checking your meeting status.",
|
||||
|
||||
Reference in New Issue
Block a user