Commit ef22043a authored by Tae Hoon's avatar Tae Hoon

add mutations

parent 2fdfb112
......@@ -79,6 +79,7 @@ const muteDomain = (store, domain) => {
const unmuteDomain = (store, domain) => {
return store.rootState.api.backendInteractor.unmuteDomain(domain)
.then(() => store.commit('removeDomainMute', domain))
}
export const mutations = {
......@@ -189,6 +190,17 @@ export const mutations = {
saveDomainMutes (state, domainMutes) {
state.currentUser.domainMutes = domainMutes
},
addDomainMute (state, domain) {
if (state.currentUser.domainMutes.indexOf(domain) === -1) {
state.currentUser.domainMutes.push(domain)
}
},
removeDomainMute (state, domain) {
const index = state.currentUser.domainMutes.indexOf(domain)
if (index !== -1) {
state.currentUser.domainMutes.splice(index, 1)
}
},
setPinnedToUser (state, status) {
const user = state.usersObject[status.user.id]
const index = user.pinnedStatusIds.indexOf(status.id)
......@@ -482,6 +494,7 @@ const users = {
user.credentials = accessToken
user.blockIds = []
user.muteIds = []
user.domainMutes = []
commit('setCurrentUser', user)
commit('addNewUsers', [user])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment