diff --git a/web/frontend/src/components/Home.vue b/web/frontend/src/components/Home.vue
index 4fe7a08..c537a4d 100644
--- a/web/frontend/src/components/Home.vue
+++ b/web/frontend/src/components/Home.vue
@@ -6,7 +6,7 @@
Total login attempts
- {{ getStat('TotalLoginAttempts') }}
+ {{ totalLoginAttempts }}
@@ -14,7 +14,7 @@
Unique passwords
- {{ getStat('UniquePasswords') }}
+ {{ uniquePasswords }}
@@ -22,7 +22,7 @@
Unique usernames
- {{ getStat('UniqueUsernames') }}
+ {{ uniqueUsernames }}
@@ -30,7 +30,7 @@
Unique IPs
- {{ getStat('UniqueIPs') }}
+ {{ uniqueIPs }}
@@ -55,27 +55,38 @@ interface TotalStatsResult {
@Component
export default class Home extends Vue {
- totalStats?: TotalStatsResult[];
+ totalLoginAttempts?: number;
+ uniquePasswords?: number;
+ uniqueUsernames?: number;
+ uniqueIPs?: number;
+ uniqueCountries?: number;
ready = false;
- @Watch('totalStats', { immediate: true, deep: true })
- getStat(key: TotalStatsHeaders): string | undefined {
- const result = this.totalStats?.find((elem) => elem.name === key);
- if (result) {
- return Number(result?.count).toLocaleString();
- }
- return undefined;
- }
-
updateStats(): void {
const url = `/api/stats?type=total`;
axios
.get(url)
.then((resp) => {
- this.totalStats = resp.data;
+ this.totalLoginAttempts = resp.data.find(
+ (e) => e.name == 'TotalLoginAttempts',
+ )?.count;
+
+ this.uniquePasswords = resp.data.find(
+ (e) => e.name == 'UniquePasswords',
+ )?.count;
+
+ this.uniqueUsernames = resp.data.find(
+ (e) => e.name == 'UniqueUsernames',
+ )?.count;
+
+ this.uniqueIPs = resp.data.find((e) => e.name == 'UniqueIPs')?.count;
+
+ this.uniqueCountries = resp.data.find(
+ (e) => e.name == 'UniqueCountries',
+ )?.count;
+
this.ready = true;
- console.log(this.totalStats);
})
.catch((e) => {
console.log(e);