Dashboard to visualize FIFA player performance
Back-end: https://github.com/tranmani/Fifa-Dashboard-API-public
npm install
quasar dev
quasar build
See Configuring quasar.conf.js.
const LOGIN = gql`
query loginList($email: String!, $password: String!) {
login(email: $email, password: $password) {
token
email
}
}
`;
data() {
return {
email: "",
password: "",
};
},
this.$apollo
.query({
query: LOGIN,
variables: {
email: this.email,
password: this.password,
},
})
.then((data) => {
// DO SOMETHING IF SUCCESS
})
.catch((error) => {
if (error) {
// DO SOMETHING IF HAVE ERROR
}
});
const REAL_TIME_XML = gql`
subscription {
newXML {
name
xmin
ymin
xmax
ymax
}
}
`;
data() {
return {
data: [],
};
},
apollo: {
$subscribe: {
data: {
query: REAL_TIME_XML,
result({ data }) {
this.data.push(data.newXML);
},
},
},
},
OR
const this_ = this;
this.$apollo
.subscribe({
query: REAL_TIME_XML,
})
.subscribe({
next(data) {
this_.data.push(data.data.newXML);
},
error(err) {
console.error("err", err);
},
});
const ALL_XML = gql`
{
allXML {
name
xmin
ymin
xmax
ymax
}
}
`;
const REAL_TIME_XML = gql`
subscription {
newXML {
name
xmin
ymin
xmax
ymax
}
}
`;
data() {
return {
data: [],
};
},
apollo: {
data: {
query: ALL_XML,
update(data) {
return data.allXML;
},
subscribeToMore: {
document: REAL_TIME_XML,
updateQuery: (previousResult, { subscriptionData }) => {
if (previousResult) {
return {
data: previousResult.allXML.push(subscriptionData.data.newXML),
};
}
},
},
},
},