Skip to content

Commit

Permalink
feat!: remove page reload
Browse files Browse the repository at this point in the history
BREAKING CHANGE: decide if you need a page reload on cookie configuration change yourself instead! Simply `watch` enabled cookies for changes you wish a page reload for and execute it in your client's code instead of having page reloads forced upon you.
  • Loading branch information
dargmuesli committed Jan 13, 2023
1 parent ea905dd commit 9b85dd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
12 changes: 3 additions & 9 deletions src/runtime/components/CookieControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
<div class="cookieControl__BarButtons">
<button
@click="setConsent({ reload: false })"
@click="setConsent({})"
v-text="localeStrings?.acceptAll"
/>
<button
Expand Down Expand Up @@ -190,12 +190,10 @@ const toogleCookie = (cookie: Cookie) => {
const setConsent = ({
type = undefined,
isConsentGiven = true,
reload = true,
declineAll = false,
}: {
type?: 'partial'
isConsentGiven?: boolean
reload?: boolean
declineAll?: boolean
}) => {
const cookieIds = declineAll
Expand All @@ -215,12 +213,8 @@ const setConsent = ({
expires: expirationDate,
})
if (reload) {
window.location.reload()
} else {
setConsentFun()
isModalActive.value = false
}
setConsentFun()
isModalActive.value = false
}
const getDescription = (description: Translatable) =>
`${
Expand Down
1 change: 0 additions & 1 deletion src/runtime/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export const acceptNecessary = (
})

setHead(cookiesEnabledRef.value)
window.location.reload()
}

export const useResolveTranslatable = (locale = LOCALE_DEFAULT) => {
Expand Down

0 comments on commit 9b85dd9

Please sign in to comment.