Added collections loading

This commit is contained in:
2020-11-26 04:44:55 +01:00
parent f85f16e2a5
commit 31f8cffec1
10 changed files with 167 additions and 43 deletions

46
src/views/Collections.vue Normal file
View File

@@ -0,0 +1,46 @@
<template>
<b-container>
<b-row>
<b-col>
<h1>My Collections</h1>
</b-col>
</b-row>
<big-chungus-loader text="Fetching collections..." v-if="processing"/>
<b-row v-else>
<collections-list-element :title="c.name" :count="c.element_count" @click="openCollection(c.id)" :key="c.id" v-for="c in collections"/>
</b-row>
</b-container>
</template>
<script>
import BigChungusLoader from "@/components/BigChungusLoader";
import CollectionsListElement from "@/components/CollectionsListElement";
export default {
name: 'Collections',
components: {BigChungusLoader, CollectionsListElement},
data() {
return {
processing: true,
collections: {}
}
},
methods: {
openCollection(id) {
console.log(id);
}
},
mounted() {
this.$api.getAllLists().then((data) => {
if (data) {
this.collections = data.ids;
this.processing = false;
} else {
this.$showToast("Invalid response from server");
}
}).catch(({text}) => {
this.$showToast(text);
});
}
}
</script>