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;
|
||||
$router!: Router;
|
||||
|
||||
// Notification helper system
|
||||
private notify = createNotifyHelpers(this.$notify);
|
||||
// Notification helper system - will be initialized in mounted()
|
||||
private notify: ReturnType<typeof createNotifyHelpers> | null = null;
|
||||
|
||||
// User interface state management
|
||||
isChoosingSearchBox = false;
|
||||
@@ -199,6 +199,9 @@ export default class SearchAreaView extends Vue {
|
||||
*/
|
||||
async mounted() {
|
||||
try {
|
||||
// Initialize notification helper system
|
||||
this.notify = createNotifyHelpers(this.$notify);
|
||||
|
||||
const settings = await this.$accountSettings();
|
||||
this.searchBox = settings.searchBoxes?.[0] || null;
|
||||
this.resetLatLong();
|
||||
@@ -321,17 +324,17 @@ export default class SearchAreaView extends Vue {
|
||||
});
|
||||
|
||||
// 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();
|
||||
} catch (err) {
|
||||
logger.error("[SearchAreaView] Failed to store search box", err);
|
||||
|
||||
// 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 {
|
||||
// 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");
|
||||
|
||||
// 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) {
|
||||
logger.error("[SearchAreaView] Failed to delete search box", err);
|
||||
|
||||
// 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