Skip to content

Commit

Permalink
FIx typecheck errors
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Feb 20, 2025
1 parent 272bf4c commit 7e5dfc8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/loot-core/src/server/preferences/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function saveGlobalPrefs(prefs: GlobalPrefs) {
await asyncStorage.setItem('max-months', '' + prefs.maxMonths);
}
if ('documentDir' in prefs) {
if (await fs.exists(prefs.documentDir)) {
if (prefs.documentDir && (await fs.exists(prefs.documentDir))) {
await asyncStorage.setItem('document-dir', prefs.documentDir);
}
}
Expand Down Expand Up @@ -140,7 +140,12 @@ async function saveMetadataPrefs(prefsToSet: MetadataPrefs) {
if (prefsToSet.budgetName && cloudFileId) {
const userToken = await asyncStorage.getItem('user-token');

await post(getServer().SYNC_SERVER + '/update-user-filename', {
const syncServer = getServer()?.SYNC_SERVER;
if (!syncServer) {
throw new Error('No sync server set');
}

await post(syncServer + '/update-user-filename', {
token: userToken,
fileId: cloudFileId,
name: prefsToSet.budgetName,
Expand All @@ -151,6 +156,6 @@ async function saveMetadataPrefs(prefsToSet: MetadataPrefs) {
return 'ok';
}

function loadMetadataPrefs(): MetadataPrefs {
async function loadMetadataPrefs(): Promise<MetadataPrefs> {
return _getMetadataPrefs();
}

0 comments on commit 7e5dfc8

Please sign in to comment.