From 91b3490b09aa124e5fce6f8de2546c577f374e6c Mon Sep 17 00:00:00 2001 From: Oliver Pietsch Date: Wed, 22 Feb 2023 17:16:57 +0000 Subject: [PATCH] #63 Optional chaining --- package.json | 2 +- src/components/CookieComply.vue | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index dd2c8a5..759cbbf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vue-cookie-comply-with-reject", "description": "A Vue 3 component to handle cookie acceptance on your website", - "version": "0.2.6", + "version": "0.2.7", "files": [ "dist" ], diff --git a/src/components/CookieComply.vue b/src/components/CookieComply.vue index 767a6ae..fea8bda 100644 --- a/src/components/CookieComply.vue +++ b/src/components/CookieComply.vue @@ -168,7 +168,10 @@ const checkValues = (): void => { emit('on-cookie-comply-mount', getConsentValuesFromStorage()); } -watch(() => route.query, () => { +watch(() => route?.query, () => { + if (!route?.query) { + return + } checkValues() }, { immediate: true