mirror of
https://github.com/BluemediaDev/video-platform.git
synced 2025-01-02 11:23:16 +01:00
Allow empty index.json
This commit is contained in:
parent
e62efcad6e
commit
28f0348d68
|
@ -10,6 +10,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clappr/player": "^0.4.6",
|
"@clappr/player": "^0.4.6",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
|
"bootstrap-icons-vue": "^1.8.1",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"vue": "^3.0.0",
|
"vue": "^3.0.0",
|
||||||
"vue-router": "^4.0.0-0"
|
"vue-router": "^4.0.0-0"
|
||||||
|
|
36
src/components/Empty.vue
Normal file
36
src/components/Empty.vue
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<template>
|
||||||
|
<div class="empty">
|
||||||
|
<BIconEyeSlashFill class="icon" />
|
||||||
|
<h1>No public videos available.</h1>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { BIconEyeSlashFill } from "bootstrap-icons-vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Empty",
|
||||||
|
components: {
|
||||||
|
BIconEyeSlashFill,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.empty {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin-right: -50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.icon {
|
||||||
|
font-size: 5rem;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -1,19 +1,21 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="home">
|
<div class="home">
|
||||||
<Loader v-if="$data.loading" />
|
<Loader v-if="$data.loading" />
|
||||||
<div v-if="!$data.loading" class="categories">
|
<div v-if="!$data.loading && !$data.empty" class="categories">
|
||||||
<Category
|
<Category
|
||||||
v-for="category in $data.categories"
|
v-for="category in $data.categories"
|
||||||
:category="category"
|
:category="category"
|
||||||
:key="category.categoryId"
|
:key="category.categoryId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<Empty v-if="$data.empty" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Loader from "@/components/Loader.vue";
|
import Loader from "@/components/Loader.vue";
|
||||||
import Category from "@/components/Category.vue";
|
import Category from "@/components/Category.vue";
|
||||||
|
import Empty from "@/components/Empty.vue";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -21,11 +23,13 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
Loader,
|
Loader,
|
||||||
Category,
|
Category,
|
||||||
|
Empty,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
categories: [],
|
categories: [],
|
||||||
loading: true,
|
loading: true,
|
||||||
|
empty: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -36,11 +40,20 @@ export default {
|
||||||
axios
|
axios
|
||||||
.get("/index.json", { baseURL: "" })
|
.get("/index.json", { baseURL: "" })
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.categories = response.data;
|
if (response.data.length > 0) {
|
||||||
|
this.categories = response.data;
|
||||||
|
} else {
|
||||||
|
this.empty = true;
|
||||||
|
}
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
if (error.response.status === 404) {
|
||||||
|
this.empty = true;
|
||||||
|
this.loading = false;
|
||||||
|
} else {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -2131,6 +2131,11 @@ boolbase@^1.0.0, boolbase@~1.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
|
||||||
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
|
integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24=
|
||||||
|
|
||||||
|
bootstrap-icons-vue@^1.8.1:
|
||||||
|
version "1.8.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/bootstrap-icons-vue/-/bootstrap-icons-vue-1.8.1.tgz#ce4a0c1f6efe41dabcc1341f2cb191d307fbaf50"
|
||||||
|
integrity sha512-uItRULwQz0epETi9x/RBEqfjHmTAmkIIczpH1R6L9T6yyaaijk0826PzTWnWNm15tw66JT/8GNuXjB0HI5PHLw==
|
||||||
|
|
||||||
brace-expansion@^1.1.7:
|
brace-expansion@^1.1.7:
|
||||||
version "1.1.11"
|
version "1.1.11"
|
||||||
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
|
||||||
|
|
Loading…
Reference in a new issue