forked from jsnbuchanan/crowd-funder-for-time-pwa
Fix: properly initialize notify + bulletproofing
This commit is contained in:
@@ -173,8 +173,8 @@ export default class SearchAreaView extends Vue {
|
|||||||
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
$notify!: (notification: NotificationIface, timeout?: number) => void;
|
||||||
$router!: Router;
|
$router!: Router;
|
||||||
|
|
||||||
// Notification helper system
|
// Notification helper system - will be initialized in mounted()
|
||||||
private notify = createNotifyHelpers(this.$notify);
|
private notify: ReturnType<typeof createNotifyHelpers> | null = null;
|
||||||
|
|
||||||
// User interface state management
|
// User interface state management
|
||||||
isChoosingSearchBox = false;
|
isChoosingSearchBox = false;
|
||||||
@@ -199,6 +199,9 @@ export default class SearchAreaView extends Vue {
|
|||||||
*/
|
*/
|
||||||
async mounted() {
|
async mounted() {
|
||||||
try {
|
try {
|
||||||
|
// Initialize notification helper system
|
||||||
|
this.notify = createNotifyHelpers(this.$notify);
|
||||||
|
|
||||||
const settings = await this.$accountSettings();
|
const settings = await this.$accountSettings();
|
||||||
this.searchBox = settings.searchBoxes?.[0] || null;
|
this.searchBox = settings.searchBoxes?.[0] || null;
|
||||||
this.resetLatLong();
|
this.resetLatLong();
|
||||||
@@ -321,17 +324,17 @@ export default class SearchAreaView extends Vue {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Enhanced notification system with proper timeout
|
// Enhanced notification system with proper timeout
|
||||||
this.notify.success(NOTIFY_SEARCH_AREA_SAVED.text, TIMEOUTS.VERY_LONG);
|
this.notify?.success(NOTIFY_SEARCH_AREA_SAVED.text, TIMEOUTS.VERY_LONG);
|
||||||
this.$router.back();
|
this.$router.back();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("[SearchAreaView] Failed to store search box", err);
|
logger.error("[SearchAreaView] Failed to store search box", err);
|
||||||
|
|
||||||
// Enhanced notification system with proper timeout
|
// Enhanced notification system with proper timeout
|
||||||
this.notify.error(NOTIFY_SEARCH_AREA_ERROR.text, TIMEOUTS.LONG);
|
this.notify?.error(NOTIFY_SEARCH_AREA_ERROR.text, TIMEOUTS.LONG);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Invalid coordinates - show validation warning
|
// Invalid coordinates - show validation warning
|
||||||
this.notify.warning(NOTIFY_SEARCH_AREA_NO_LOCATION.text, TIMEOUTS.LONG);
|
this.notify?.warning(NOTIFY_SEARCH_AREA_NO_LOCATION.text, TIMEOUTS.LONG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,12 +364,12 @@ export default class SearchAreaView extends Vue {
|
|||||||
logger.info("[SearchAreaView] Search box deleted successfully");
|
logger.info("[SearchAreaView] Search box deleted successfully");
|
||||||
|
|
||||||
// Enhanced notification system with proper timeout
|
// Enhanced notification system with proper timeout
|
||||||
this.notify.success(NOTIFY_SEARCH_AREA_DELETED.text, TIMEOUTS.STANDARD);
|
this.notify?.success(NOTIFY_SEARCH_AREA_DELETED.text, TIMEOUTS.STANDARD);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error("[SearchAreaView] Failed to delete search box", err);
|
logger.error("[SearchAreaView] Failed to delete search box", err);
|
||||||
|
|
||||||
// Enhanced notification system with proper timeout
|
// Enhanced notification system with proper timeout
|
||||||
this.notify.error(NOTIFY_SEARCH_AREA_ERROR.text, TIMEOUTS.LONG);
|
this.notify?.error(NOTIFY_SEARCH_AREA_ERROR.text, TIMEOUTS.LONG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user