mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix initial type; implement and simplify button disable logic
This commit is contained in:
parent
820c52ded2
commit
ba5fe8ff0e
@ -27,7 +27,7 @@ import { updateUserMutation } from '~/graphql/User'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
emailNotificationSettings: {},
|
||||
emailNotificationSettings: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -35,19 +35,18 @@ export default {
|
||||
currentUser: 'auth/user',
|
||||
}),
|
||||
isSubmitDisabled() {
|
||||
return Object.entries(this.emailNotificationSettings).every(
|
||||
// TODO deep equals
|
||||
(value, index) => value === this.currentUser.emailNotificationSettings[index],
|
||||
return this.emailNotificationSettings.every(
|
||||
(topic) => topic.settings.every(setting => setting.value === this.currentUser.emailNotificationSettings.find(t => t.type === topic.type).settings.find(s => s.name === setting.name).value),
|
||||
)
|
||||
},
|
||||
isCheckAllDisabled() {
|
||||
return Object.entries(this.emailNotificationSettings).every(
|
||||
(topic) => topic[1].settings.every(setting => setting.value),
|
||||
return this.emailNotificationSettings.every(
|
||||
(topic) => topic.settings.every(setting => setting.value),
|
||||
)
|
||||
},
|
||||
isUncheckAllDisabled() {
|
||||
return Object.entries(this.emailNotificationSettings).every(
|
||||
(topic) => topic[1].settings.every(setting => !setting.value),
|
||||
return this.emailNotificationSettings.every(
|
||||
(topic) => topic.settings.every(setting => !setting.value),
|
||||
)
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user