mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-26 10:24:40 +03:00
⚡ Moves common functionality into reusable mixin
This commit is contained in:
parent
e0b09d48ee
commit
771e2f3717
@ -18,9 +18,6 @@ export default {
|
||||
chartDom: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* The crypto asset to fetch price data for */
|
||||
asset() {
|
||||
@ -61,11 +58,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Create new chart, using the crypto data */
|
||||
generateChart() {
|
||||
return new Chart(`#${this.chartId}`, {
|
||||
|
@ -32,9 +32,6 @@ export default {
|
||||
cryptoData: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* The crypto assets to fetch price data for */
|
||||
assets() {
|
||||
@ -82,11 +79,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to CoinGecko API endpoint */
|
||||
fetchData() {
|
||||
axios.get(this.endpoint)
|
||||
|
@ -24,9 +24,6 @@ export default {
|
||||
exchangeRates: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* The users API key for exchangerate-api.com */
|
||||
apiKey() {
|
||||
@ -51,11 +48,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to CoinGecko API endpoint */
|
||||
fetchData() {
|
||||
axios.get(this.endpoint)
|
||||
|
@ -43,9 +43,6 @@ export default {
|
||||
arrivals: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
filters: {
|
||||
formatDate(date) {
|
||||
const d = new Date(date);
|
||||
@ -105,11 +102,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to CoinGecko API endpoint */
|
||||
fetchData() {
|
||||
const requestConfig = {
|
||||
|
@ -20,9 +20,6 @@ export default {
|
||||
jokeLine2: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* Language code to fetch jokes for */
|
||||
language() {
|
||||
@ -53,11 +50,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to Jokes API endpoint */
|
||||
fetchData() {
|
||||
axios.get(this.endpoint)
|
||||
|
@ -17,9 +17,6 @@ export default {
|
||||
chartDom: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* URL where NetData is hosted */
|
||||
netDataHost() {
|
||||
|
@ -17,9 +17,6 @@ export default {
|
||||
chartDom: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* URL where NetData is hosted */
|
||||
netDataHost() {
|
||||
|
@ -13,9 +13,6 @@ import ChartingMixin from '@/mixins/ChartingMixin';
|
||||
export default {
|
||||
mixins: [WidgetMixin, ChartingMixin],
|
||||
components: {},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* URL where NetData is hosted */
|
||||
netDataHost() {
|
||||
|
@ -42,9 +42,6 @@ export default {
|
||||
posts: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* The URL to users atom-format RSS feed */
|
||||
rssUrl() {
|
||||
@ -91,11 +88,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to Rss2Json */
|
||||
fetchData() {
|
||||
axios.get(this.endpoint)
|
||||
|
@ -18,9 +18,6 @@ export default {
|
||||
chartDom: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* The stock or share asset symbol to fetch data for */
|
||||
stock() {
|
||||
@ -66,11 +63,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Create new chart, using the crypto data */
|
||||
generateChart() {
|
||||
return new Chart(`#${this.chartId}`, {
|
||||
|
@ -52,11 +52,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to CoinGecko API endpoint */
|
||||
fetchData() {
|
||||
axios.get(this.endpoint)
|
||||
|
@ -49,11 +49,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Makes GET request to the TFL API */
|
||||
fetchData() {
|
||||
axios.get(widgetApiEndpoints.tflStatus)
|
||||
@ -114,10 +109,6 @@ export default {
|
||||
this.showAll = !this.showAll;
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (this.options.showAll) this.showAll = true;
|
||||
this.fetchData();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -23,9 +23,6 @@ export default {
|
||||
comicNum: '',
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.fetchData();
|
||||
},
|
||||
computed: {
|
||||
/* Let user select which comic to display: random, latest or a specific number */
|
||||
comicNumber() {
|
||||
@ -44,11 +41,6 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/* Extends mixin, and updates data. Called by parent component */
|
||||
update() {
|
||||
this.startLoading();
|
||||
this.fetchData();
|
||||
},
|
||||
/* Make GET request to CoinGecko API endpoint */
|
||||
fetchData() {
|
||||
axios.get(this.endpoint)
|
||||
|
Loading…
Reference in New Issue
Block a user