feat(vault): add get/create assets API in workflow

TODO: update vault.service.ts. Use MNEMONIC workflow to create real private_key_shard and content_inner_encrypted
This commit is contained in:
Ada
2026-02-01 09:19:45 -08:00
parent 536513ab3f
commit f6fa19d0b2
9 changed files with 628 additions and 78 deletions

View File

@@ -142,11 +142,16 @@ export const assetsService = {
body: JSON.stringify(asset),
});
logApiDebug('Create Asset Response Status', response.status);
const responseStatus = response.status;
logApiDebug('Create Asset Response Status', responseStatus);
if (!response.ok) {
const errorData = await response.json().catch(() => ({}));
throw new Error(errorData.detail || 'Failed to create asset');
const detail = errorData.detail || 'Failed to create asset';
const message = responseStatus === 401 ? `Unauthorized (401): ${detail}` : detail;
const err = new Error(message) as Error & { status?: number };
err.status = responseStatus;
throw err;
}
return await response.json();