diff --git a/packages/frontend/src/account.ts b/packages/frontend/src/account.ts index fb31fef380..722f296732 100644 --- a/packages/frontend/src/account.ts +++ b/packages/frontend/src/account.ts @@ -56,13 +56,32 @@ export function signinRequired() { return $i; } +/** + * Extracts the current number of notes from the current account. + * + * Note: This appears to only be used for the "notes1" achievement. + * + * Also, separating it like this might cause counts to get out-of-sync. + */ export let notesCount = $i == null ? 0 : $i.notesCount; + +/** + * Increments the number of notes by one. + * + * Documentation TODO: What about $i.notesCount? Why not increment that? + */ export function incNotesCount() { notesCount++; } export async function signout() { - if (!$i) return; + + // If we're not signed in, there's nothing to do. + if (!$i) { + // Error log: + console.error('signout() called when not signed in'); + return; + } waiting(); miLocalStorage.removeItem('account');