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.isRegistered !== undefined
|
||||
) {
|
||||
|
||||
// Update firstName
|
||||
await platform.dbExec(
|
||||
"UPDATE settings SET firstName = ? WHERE accountDid = ?",
|
||||
|
||||
@@ -640,10 +640,6 @@ export async function saveNewIdentity(
|
||||
await databaseUtil.updateDefaultSettings({ activeDid: identity.did });
|
||||
|
||||
await databaseUtil.insertDidSpecificSettings(identity.did);
|
||||
|
||||
// Check what was actually created
|
||||
const createdSettings =
|
||||
await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
} catch (error) {
|
||||
logger.error("Failed to update default settings:", error);
|
||||
throw new Error(
|
||||
@@ -921,7 +917,6 @@ export async function importFromMnemonic(
|
||||
derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH,
|
||||
shouldErase: boolean = false,
|
||||
): Promise<void> {
|
||||
|
||||
const mne: string = mnemonic.trim().toLowerCase();
|
||||
|
||||
// Check if this is Test User #0
|
||||
@@ -946,53 +941,12 @@ export async function importFromMnemonic(
|
||||
|
||||
// Set up Test User #0 specific settings
|
||||
if (isTestUser0) {
|
||||
// First, let's see what's currently in the database
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const existingResult = await platformService.dbQuery(
|
||||
"SELECT * FROM settings WHERE accountDid = ?",
|
||||
[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];
|
||||
}
|
||||
|
||||
// Set up Test User #0 specific settings
|
||||
await databaseUtil.updateDidSpecificSettings(newId.did, {
|
||||
firstName: "User Zero",
|
||||
isRegistered: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Check what settings were created
|
||||
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -210,11 +210,12 @@ export default class ImportAccountView extends Vue {
|
||||
// Check account-specific settings
|
||||
if (settings?.activeDid) {
|
||||
try {
|
||||
const accountSettings = await this.$query(
|
||||
"SELECT * FROM settings WHERE accountDid = ?",
|
||||
[settings.activeDid],
|
||||
);
|
||||
await this.$query("SELECT * FROM settings WHERE accountDid = ?", [
|
||||
settings.activeDid,
|
||||
]);
|
||||
} 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;
|
||||
|
||||
async created() {
|
||||
|
||||
const settings = await this.$accountSettings();
|
||||
|
||||
if (settings?.activeDid) {
|
||||
try {
|
||||
// Check master settings
|
||||
const masterSettings = await this.$query(
|
||||
"SELECT * FROM settings WHERE id = ?",
|
||||
[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");
|
||||
// Verify database settings are accessible
|
||||
await this.$query("SELECT * FROM settings WHERE accountDid = ?", [
|
||||
settings.activeDid,
|
||||
]);
|
||||
} catch (error) {
|
||||
logger.error("Error checking raw database:", error);
|
||||
logger.error("Error checking database settings:", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user