From 8418c21096a80414fd0dceb08f7c91c72d2fd957 Mon Sep 17 00:00:00 2001 From: Jai A Date: Sun, 11 Apr 2021 11:21:41 -0700 Subject: [PATCH] Fix privacy settings not reflecting cookie values --- pages/dashboard/privacy.vue | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pages/dashboard/privacy.vue b/pages/dashboard/privacy.vue index ce0fd17b0..eed5d5f66 100644 --- a/pages/dashboard/privacy.vue +++ b/pages/dashboard/privacy.vue @@ -48,17 +48,23 @@ import scopes from '@/privacy-toggles' export default { name: 'Privacy', fetch() { - Object.keys(scopes.settings).forEach((key) => { - scopes.settings[key].value = scopes.settings[key].default - }) + if (this.$cookies.get('modrinth-scopes') !== null) { + this.$store.dispatch('consent/loadFromCookies', this.$cookies) - this.$store.dispatch('consent/loadFromCookies', this.$cookies) + Object.keys(scopes.settings).forEach((key) => { + scopes.settings[key].value = false + }) - // Load the allowed scopes from the store - this.$store.state.consent.scopes_allowed.forEach((scope) => { - if (this.scopes[scope] != null) - this.$set(this.scopes[scope], 'value', true) - }) + // Load the allowed scopes from the store + this.$store.state.consent.scopes_allowed.forEach((scope) => { + if (this.scopes[scope] != null) + this.$set(this.scopes[scope], 'value', true) + }) + } else { + Object.keys(scopes.settings).forEach((key) => { + scopes.settings[key].value = scopes.settings[key].default + }) + } }, data: () => { const settings = scopes.settings