forked from jsnbuchanan/crowd-funder-for-time-pwa
modify the settings to allow account-specific settings, eg. for "isRegistered"
This commit is contained in:
@@ -292,9 +292,12 @@ import { Router } from "vue-router";
|
||||
import { useClipboard } from "@vueuse/core";
|
||||
|
||||
import { AppString, NotificationIface } from "@/constants/app";
|
||||
import { db } from "@/db/index";
|
||||
import {
|
||||
db,
|
||||
retrieveSettingsForActiveAccount,
|
||||
updateDefaultSettings,
|
||||
} from "@/db/index";
|
||||
import { Contact } from "@/db/tables/contacts";
|
||||
import { MASTER_SETTINGS_KEY, Settings } from "@/db/tables/settings";
|
||||
import { getContactPayloadFromJwtUrl } from "@/libs/crypto";
|
||||
import {
|
||||
CONTACT_CSV_HEADER,
|
||||
@@ -352,14 +355,14 @@ export default class ContactsView extends Vue {
|
||||
|
||||
public async created() {
|
||||
await db.open();
|
||||
const settings = (await db.settings.get(MASTER_SETTINGS_KEY)) as Settings;
|
||||
this.activeDid = settings?.activeDid || "";
|
||||
this.apiServer = settings?.apiServer || "";
|
||||
this.isRegistered = !!settings?.isRegistered;
|
||||
const settings = await retrieveSettingsForActiveAccount();
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
this.isRegistered = !!settings.isRegistered;
|
||||
|
||||
this.showGiveNumbers = !!settings?.showContactGivesInline;
|
||||
this.showGiveNumbers = !!settings.showContactGivesInline;
|
||||
this.hideRegisterPromptOnNewContact =
|
||||
!!settings?.hideRegisterPromptOnNewContact;
|
||||
!!settings.hideRegisterPromptOnNewContact;
|
||||
|
||||
if (this.showGiveNumbers) {
|
||||
this.loadGives();
|
||||
@@ -715,7 +718,7 @@ export default class ContactsView extends Vue {
|
||||
text: "Do you want to register them?",
|
||||
onCancel: async (stopAsking: boolean) => {
|
||||
if (stopAsking) {
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
await updateDefaultSettings({
|
||||
hideRegisterPromptOnNewContact: stopAsking,
|
||||
});
|
||||
this.hideRegisterPromptOnNewContact = stopAsking;
|
||||
@@ -723,7 +726,7 @@ export default class ContactsView extends Vue {
|
||||
},
|
||||
onNo: async (stopAsking: boolean) => {
|
||||
if (stopAsking) {
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
await updateDefaultSettings({
|
||||
hideRegisterPromptOnNewContact: stopAsking,
|
||||
});
|
||||
this.hideRegisterPromptOnNewContact = stopAsking;
|
||||
@@ -1067,8 +1070,7 @@ export default class ContactsView extends Vue {
|
||||
private async toggleShowContactAmounts() {
|
||||
const newShowValue = !this.showGiveNumbers;
|
||||
try {
|
||||
await db.open();
|
||||
await db.settings.update(MASTER_SETTINGS_KEY, {
|
||||
await updateDefaultSettings({
|
||||
showContactGivesInline: newShowValue,
|
||||
});
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user