Skip to content

Commit

Permalink
perf: upload metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Soulter committed Oct 28, 2024
1 parent 62e3148 commit 3e0f30d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ export default {
this.$store.commit('initMetadata', 'post_rules')
this.$store.commit('initMetadata', 'beianhao')
this.$store.commit('fetchPublicObject', this.$bus)
this.$store.commit('uploadMetrics')
},
methods: {
logout() {
Cookies.remove("access-token");
// reload
window.location.reload()
},
}
},
}
</script>

Expand Down
18 changes: 18 additions & 0 deletions frontend/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,24 @@ export default createStore({
}
})
},
uploadMetrics() {
// this method is used to upload metrics to our server to analyze the product usage,
// so that we can improve the product in the future.
fetch("https://tickstats.idoknow.top/api/metric/c91cd32d", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
metrics_data: {
"os_name": window.navigator.platform,
"browser": window.navigator.userAgent,
"host": window.location.host,
"tick": 1,
}
}),
});
},
getVersion(state) {
axios.get(this.state.base_url + '/v1/misc/get-version')
.then(res => {
Expand Down

0 comments on commit 3e0f30d

Please sign in to comment.