Browse Source

Fix: properly initialize notify + bulletproofing

pull/142/head
Jose Olarte III 2 days ago
parent
commit
e4097f7e4c
  1. 17
      src/views/SearchAreaView.vue

17
src/views/SearchAreaView.vue

@ -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);
} }
} }

Loading…
Cancel
Save