Make data fetching use the actual value from control bar and store the config in the data object.
This commit is contained in:
parent
948efcc54b
commit
88bd16ae69
1 changed files with 2 additions and 1 deletions
|
|
@ -70,7 +70,7 @@ export default {
|
||||||
get_data(config) {
|
get_data(config) {
|
||||||
let url = `${this.api_base}/me/top/${config.type.toLowerCase()}`;
|
let url = `${this.api_base}/me/top/${config.type.toLowerCase()}`;
|
||||||
|
|
||||||
let limit = parseInt(config.count) || 10;
|
let limit = config.limit || 10;
|
||||||
|
|
||||||
url += `?limit=${limit}&time_range=${config.duration}`;
|
url += `?limit=${limit}&time_range=${config.duration}`;
|
||||||
|
|
||||||
|
|
@ -79,6 +79,7 @@ export default {
|
||||||
{ headers: { Authorization: `Bearer ${this.get_token()}` } }
|
{ headers: { Authorization: `Bearer ${this.get_token()}` } }
|
||||||
).then((response) => {
|
).then((response) => {
|
||||||
this.error = ``;
|
this.error = ``;
|
||||||
|
this.config = config;
|
||||||
this.data = response.data.items;
|
this.data = response.data.items;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.error = `${err.name}: ${err.message}`
|
this.error = `${err.name}: ${err.message}`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue