Commit 7591ff4e authored by Aljaz S.'s avatar Aljaz S. 🚀
Browse files

Added the "reviews" thingy to the Toolbar

parent 2efcf6a4
......@@ -60,14 +60,40 @@
</template>
<span>View GitHub repo</span>
</v-tooltip>
<v-tooltip bottom v-if="$vuetify.breakpoint.smAndUp">
<template v-slot:activator="{ on }">
<v-btn
class="btnnarrow"
href="https://www.spigotmc.org/resources/skinsrestorer.2124/reviews"
target="_blank"
flat
v-on="on"
>
<span
:style="{
'font-weight': 600,
'margin': 'auto',
'margin-right': '7px'
}"
v-text="avgSpigotRating"
/>
<v-icon>mdi-star</v-icon>
</v-btn>
</template>
<span>{{ avgSpigotRatings }} reviews on SpigotMC</span>
</v-tooltip>
</v-toolbar>
</template>
<script>
import Store from '@/store'
import axios from 'axios'
export default {
name: 'Toolbar',
data: ()=>{return {
disabledReload: false
disabledReload: false,
avgSpigotRating: "Loading ...",
avgSpigotRatings: "Loading",
}},
computed: {
appDark: () => Store.getters['App/darkMode'],
......@@ -90,6 +116,19 @@ export default {
Store.dispatch('App/fetchAll')
}
},
async mounted () {
this.avgSpigotRating = "Loading ..."
this.avgSpigotRatings = "Loading ..."
const res = await axios.get('https://api.spiget.org/v2/resources/2124')
console.log(res)
if (res && res.status === 200) {
this.avgSpigotRating = `${res.data.rating.average.toFixed(2)}/5`
this.avgSpigotRatings = res.data.rating.count
} else {
this.avgSpigotRating = "Data fetch failed!"
this.avgSpigotRatings = "Data fetch failed!"
}
}
}
</script>
<style scoped>
......
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