Skip to content

Commit

Permalink
feat(stats): add "delete all data" button
Browse files Browse the repository at this point in the history
  • Loading branch information
arxanas committed Oct 5, 2020
1 parent f6498d5 commit b8036d7
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion src/views/Stats.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
<template>
<v-card>
<v-card-title>Stats</v-card-title>
<v-card-text>TODO</v-card-text>
<v-card-text
>Stats aren't currently available. Check back later!</v-card-text
>
<v-card-actions>
<v-spacer />
<v-btn class="error" @click="deleteAllData">Delete all data</v-btn>
</v-card-actions>
</v-card>
</template>

<script lang="ts">
import Vue from "vue";
import Component from "vue-class-component";
import { commitSnackbarText } from "../store";
@Component
export default class extends Vue {
public deleteAllData(): void {
let confirmation = prompt("Type 'delete' to confirm.");
if (confirmation === null) {
confirmation = "";
}
confirmation = confirmation.toLowerCase().trim();
if (confirmation === "delete") {
commitSnackbarText(this.$store, "Deleted all data.");
localStorage.clear();
window.location.assign("/");
} else {
commitSnackbarText(
this.$store,
"Confirmation failed — no data was deleted.",
);
}
}
}
</script>

0 comments on commit b8036d7

Please sign in to comment.