forked from trent_larson/crowd-funder-for-time-pwa
Fix unused variables and formatting from console.log cleanup
- Remove unused existingResult variable from importFromMnemonic function - Fix empty catch block with proper error handling in ImportAccountView.vue - Simplify debug database check in OnboardMeetingListView.vue - Apply prettier formatting fixes across all modified files - Resolve all 12 lint errors, maintaining only 16 pre-existing warnings - Verify build passes with all changes
This commit is contained in:
@@ -107,7 +107,6 @@ export async function updateDidSpecificSettings(
|
|||||||
settingsChanges.firstName &&
|
settingsChanges.firstName &&
|
||||||
settingsChanges.isRegistered !== undefined
|
settingsChanges.isRegistered !== undefined
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// Update firstName
|
// Update firstName
|
||||||
await platform.dbExec(
|
await platform.dbExec(
|
||||||
"UPDATE settings SET firstName = ? WHERE accountDid = ?",
|
"UPDATE settings SET firstName = ? WHERE accountDid = ?",
|
||||||
|
|||||||
@@ -640,10 +640,6 @@ export async function saveNewIdentity(
|
|||||||
await databaseUtil.updateDefaultSettings({ activeDid: identity.did });
|
await databaseUtil.updateDefaultSettings({ activeDid: identity.did });
|
||||||
|
|
||||||
await databaseUtil.insertDidSpecificSettings(identity.did);
|
await databaseUtil.insertDidSpecificSettings(identity.did);
|
||||||
|
|
||||||
// Check what was actually created
|
|
||||||
const createdSettings =
|
|
||||||
await databaseUtil.retrieveSettingsForActiveAccount();
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Failed to update default settings:", error);
|
logger.error("Failed to update default settings:", error);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -921,7 +917,6 @@ export async function importFromMnemonic(
|
|||||||
derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH,
|
derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH,
|
||||||
shouldErase: boolean = false,
|
shouldErase: boolean = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|
||||||
const mne: string = mnemonic.trim().toLowerCase();
|
const mne: string = mnemonic.trim().toLowerCase();
|
||||||
|
|
||||||
// Check if this is Test User #0
|
// Check if this is Test User #0
|
||||||
@@ -946,53 +941,12 @@ export async function importFromMnemonic(
|
|||||||
|
|
||||||
// Set up Test User #0 specific settings
|
// Set up Test User #0 specific settings
|
||||||
if (isTestUser0) {
|
if (isTestUser0) {
|
||||||
// First, let's see what's currently in the database
|
// Set up Test User #0 specific settings
|
||||||
const platformService = PlatformServiceFactory.getInstance();
|
await databaseUtil.updateDidSpecificSettings(newId.did, {
|
||||||
const existingResult = await platformService.dbQuery(
|
firstName: "User Zero",
|
||||||
"SELECT * FROM settings WHERE accountDid = ?",
|
isRegistered: true,
|
||||||
[newId.did],
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// Let's also see the actual data by mapping it
|
|
||||||
if (existingResult?.values?.length) {
|
|
||||||
const existingData = databaseUtil.mapColumnsToValues(
|
|
||||||
existingResult.columns,
|
|
||||||
existingResult.values,
|
|
||||||
)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Let's also check what's in the master settings
|
|
||||||
const masterResult = await platformService.dbQuery(
|
|
||||||
"SELECT * FROM settings WHERE id = ?",
|
|
||||||
["MASTER"],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Now try the UPDATE with better debugging
|
|
||||||
const updateResult = await databaseUtil.updateDidSpecificSettings(
|
|
||||||
newId.did,
|
|
||||||
{
|
|
||||||
firstName: "User Zero",
|
|
||||||
isRegistered: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Verify the settings were saved
|
|
||||||
const verifyResult = await platformService.dbQuery(
|
|
||||||
"SELECT * FROM settings WHERE accountDid = ?",
|
|
||||||
[newId.did],
|
|
||||||
);
|
|
||||||
|
|
||||||
if (verifyResult?.values?.length) {
|
|
||||||
const verifiedData = databaseUtil.mapColumnsToValues(
|
|
||||||
verifyResult.columns,
|
|
||||||
verifyResult.values,
|
|
||||||
)[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check what settings were created
|
|
||||||
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -210,11 +210,12 @@ export default class ImportAccountView extends Vue {
|
|||||||
// Check account-specific settings
|
// Check account-specific settings
|
||||||
if (settings?.activeDid) {
|
if (settings?.activeDid) {
|
||||||
try {
|
try {
|
||||||
const accountSettings = await this.$query(
|
await this.$query("SELECT * FROM settings WHERE accountDid = ?", [
|
||||||
"SELECT * FROM settings WHERE accountDid = ?",
|
settings.activeDid,
|
||||||
[settings.activeDid],
|
]);
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
// Log error but don't interrupt import flow
|
||||||
|
this.$logError("Error checking post-import settings: " + error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,32 +154,16 @@ export default class OnboardMeetingListView extends Vue {
|
|||||||
showPasswordDialog = false;
|
showPasswordDialog = false;
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
|
|
||||||
const settings = await this.$accountSettings();
|
const settings = await this.$accountSettings();
|
||||||
|
|
||||||
if (settings?.activeDid) {
|
if (settings?.activeDid) {
|
||||||
try {
|
try {
|
||||||
// Check master settings
|
// Verify database settings are accessible
|
||||||
const masterSettings = await this.$query(
|
await this.$query("SELECT * FROM settings WHERE accountDid = ?", [
|
||||||
"SELECT * FROM settings WHERE id = ?",
|
settings.activeDid,
|
||||||
[1],
|
]);
|
||||||
);
|
|
||||||
|
|
||||||
// Check account-specific settings
|
|
||||||
const accountSettings = await this.$query(
|
|
||||||
"SELECT * FROM settings WHERE accountDid = ?",
|
|
||||||
[settings.activeDid],
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check if there are any settings with isRegistered = 1
|
|
||||||
const registeredSettings = await this.$query(
|
|
||||||
"SELECT * FROM settings WHERE isRegistered = 1",
|
|
||||||
);
|
|
||||||
|
|
||||||
// Check all settings for this user
|
|
||||||
const allSettings = await this.$query("SELECT * FROM settings");
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error("Error checking raw database:", error);
|
logger.error("Error checking database settings:", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user