dashboard/api: add support for Zeppelin staff members; add ViewGuild permission; code cleanup

This commit is contained in:
Dragory 2020-05-23 16:22:03 +03:00
parent 7e60950900
commit d03d729438
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
13 changed files with 175 additions and 75 deletions

View file

@ -41,7 +41,17 @@
AceEditor,
},
async mounted() {
await this.$store.dispatch("guilds/loadAvailableGuilds");
try {
await this.$store.dispatch("guilds/loadGuild", this.$route.params.guildId);
} catch (err) {
if (err instanceof ApiError) {
this.$router.push('/dashboard');
return;
}
throw err;
}
if (this.guild == null) {
this.$router.push('/dashboard');
return;
@ -66,7 +76,7 @@
computed: {
...mapState('guilds', {
guild() {
return this.$store.state.guilds.available.find(g => g.id === this.$route.params.guildId);
return this.$store.state.guilds.available.get(this.$route.params.guildId);
},
config() {
return this.$store.state.guilds.configs[this.$route.params.guildId];

View file

@ -42,7 +42,7 @@
computed: {
...mapState('guilds', {
guilds: state => {
const guilds = Array.from(state.available || []);
const guilds = Array.from(state.available.values());
guilds.sort((a, b) => {
if (a.name > b.name) return 1;
if (a.name < b.name) return -1;