Skip to content

Commit 82a264a

Browse files
committed
Fix bugs and better error messages
1 parent b27da6b commit 82a264a

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

components/mixins/blacklistable.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ export default {
2020
name: this.author().name || this.$t('component.contribution.creatorUnknown')
2121
})
2222
} catch (error) {
23-
console.log(error)
24-
message = String(error)
23+
message = this.$t('component.error.general')
24+
throw (error)
25+
} finally {
26+
this.$snackbar.open({ message })
2527
}
26-
this.$snackbar.open({ message })
2728
}
2829
}
2930
}

locales/de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"copy403": "Tut uns leid, der Zugang zu dieser Seite bleibt dir verwehrt. <br />Überprüfe die Adresse, <a href=\"/auth/login\">melde dich an</a> oder <a href=\"/\">geh auf Anfang</a>.",
1515
"copy404": "Tut uns leid, wir haben diese Seite nicht gefunden. <br />Überprüfe die Adresse, <a href=\"/\">geh auf Anfang</a> oder <a href=\"mailto:[email protected]\">melde uns diesen Fehler.</a>",
1616
"copy500": "Oh nein, es ist irgend ein Fehler aufgetreten und wir mussten aufgeben. <br />Überprüfe die Adresse, <a href=\"/\">geh auf Anfang</a> oder <a href=\"mailto:[email protected]\">melde uns diesen Fehler.</a>",
17-
"copy503": "Wir arbeiten gerade dran, <br />nimm dir nen Kaffee und versuchs danach gleich nochmal."
17+
"copy503": "Wir arbeiten gerade dran, <br />nimm dir nen Kaffee und versuchs danach gleich nochmal.",
18+
"general": "Ups, da ist etwas schief gelaufen."
1819
},
1920
"badges": {
2021
"user_role_moderator": "Moderator",

locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"copy403": "Sorry, access to this resource on the server is denied. <br />Either check the URL, <a href=\"/auth/login\">login</a> or <a href=\"/\">go home</a>.",
1515
"copy404": "Sorry, the page you're looking for cannot be found. <br />Either check the URL, <a href=\"/\">go home</a>, or feel free to <a href=\"mailto:[email protected]\">report this issue.</a>",
1616
"copy500": "An error ocurred and your request couldn’t be completed. <br />Either check the URL, <a href=\"/\">go home</a>, or feel free to <a href=\"mailto:[email protected]\">report this issue.</a>",
17-
"copy503": "We are currently working on it, <br />so take a coffee brake and come back a bit later."
17+
"copy503": "We are currently working on it, <br />so take a coffee brake and come back a bit later.",
18+
"general": "Oops, something went terribly wrong"
1819
},
1920
"badges": {
2021
"user_role_moderator": "Moderator",

store/services/usersettings.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ let servicePlugin = (feathersClient) => {
55
const servicePath = 'usersettings'
66
const servicePlugin = service(servicePath, {
77
namespace: 'feathers-vuex-usersettings',
8+
instanceDefaults: {
9+
blacklist: []
10+
},
811
getters: {
912
isPending: (state) => {
1013
return (
@@ -30,12 +33,14 @@ let servicePlugin = (feathersClient) => {
3033
},
3134
async toggleBlacklist ({commit, dispatch, state}, author) {
3235
let current = state.copy
36+
let blacklist = current.blacklist
3337
let userId = author._id
34-
if (current.blacklist.includes(userId)) {
35-
current.blacklist = current.blacklist.filter(id => id !== userId)
38+
if (blacklist.includes(userId)) {
39+
blacklist = blacklist.filter(id => id !== userId)
3640
} else {
37-
current.blacklist.push(userId)
41+
blacklist.push(userId)
3842
}
43+
current.blacklist = blacklist
3944
await commit('commitCopy')
4045
return dispatch('patch', [current._id, current, {}])
4146
}

0 commit comments

Comments
 (0)