add settings table to store names (and other things soon)
This commit is contained in:
@@ -50,6 +50,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
import { db } from "@/db";
|
||||
import { MASTER_SETTINGS } from "@/db/tables";
|
||||
|
||||
@Options({
|
||||
components: {},
|
||||
@@ -64,13 +66,24 @@ export default class NewEditAccountView extends Vue {
|
||||
? "--"
|
||||
: localStorage.getItem("lastName");
|
||||
|
||||
// 'created' hook runs when the Vue instance is first created
|
||||
async created() {
|
||||
await db.open();
|
||||
const settings = await db.settings.get(MASTER_SETTINGS);
|
||||
if (settings) {
|
||||
this.firstName = settings.firstName || "";
|
||||
this.lastName = settings.lastName || "";
|
||||
}
|
||||
}
|
||||
|
||||
onClickSaveChanges() {
|
||||
db.settings.update(MASTER_SETTINGS, {
|
||||
firstName: this.firstName,
|
||||
lastName: this.lastName,
|
||||
});
|
||||
localStorage.setItem("firstName", this.firstName as string);
|
||||
localStorage.setItem("lastName", this.lastName as string);
|
||||
const route = {
|
||||
name: "account",
|
||||
};
|
||||
this.$router.push(route);
|
||||
this.$router.push({ name: "account" });
|
||||
}
|
||||
|
||||
onClickCancel() {
|
||||
|
||||
Reference in New Issue
Block a user