Fix registration status reactivity in HomeView

Resolved issue where registration banner persisted despite successful API registration.
Root cause was loadSettings() being called after initializeIdentity(), overwriting
updated isRegistered value with stale database data.

Changes:
- Remove redundant loadSettings() call from mounted() lifecycle
- Add $nextTick() to force template re-render after registration updates
- Create isUserRegistered computed property for template reactivity
- Clean up debugging console.log statements for production readiness
- Simplify template logic to use standard v-if/v-else pattern

Registration banner now properly disappears when users are registered, and
"Record something given by:" section appears correctly. Fix maintains existing
functionality while ensuring proper Vue reactivity.
This commit is contained in:
Matthew Raymer
2025-07-18 05:10:28 +00:00
parent 901186cbc7
commit 216e245d60
6 changed files with 150 additions and 25 deletions

View File

@@ -417,6 +417,7 @@ export async function getHeaders(
try {
let token;
const account = await retrieveAccountMetadata(did);
logger.debug(`[getHeaders] Account metadata for DID ${did}:`, !!account);
if (account?.passkeyCredIdHex) {
if (
passkeyAccessToken &&
@@ -424,8 +425,10 @@ export async function getHeaders(
) {
// there's an active current passkey token
token = passkeyAccessToken;
logger.debug(`[getHeaders] Using cached passkey token for DID ${did}`);
} else {
// there's no current passkey token or it's expired
logger.debug(`[getHeaders] Generating new access token for DID ${did}`);
token = await accessToken(did);
passkeyAccessToken = token;
@@ -434,9 +437,11 @@ export async function getHeaders(
Date.now() / 1000 + passkeyExpirationSeconds;
}
} else {
logger.debug(`[getHeaders] No passkey, generating access token for DID ${did}`);
token = await accessToken(did);
}
headers["Authorization"] = "Bearer " + token;
logger.debug(`[getHeaders] Successfully generated headers for DID ${did}`);
} catch (error) {
// This rarely happens: we've seen it when they have account info but the
// encryption secret got lost. But in most cases we want users to at
@@ -460,6 +465,7 @@ export async function getHeaders(
}
} else {
// it's usually OK to request without auth; we assume we're only here when allowed
logger.debug(`[getHeaders] No DID provided, proceeding without authentication`);
}
return headers;
}
@@ -1483,7 +1489,13 @@ export async function fetchEndorserRateLimits(
) {
const url = `${apiServer}/api/report/rateLimits`;
const headers = await getHeaders(issuerDid);
return await axios.get(url, { headers } as AxiosRequestConfig);
try {
const response = await axios.get(url, { headers } as AxiosRequestConfig);
return response;
} catch (error) {
logger.error(`[fetchEndorserRateLimits] Error for DID ${issuerDid}:`, errorStringForLog(error));
throw error;
}
}
/**