mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
refactor(updateCredentialsController): return error if event is undefined
This commit is contained in:
parent
30d7f1a053
commit
dfff24d3b2
1 changed files with 5 additions and 1 deletions
|
|
@ -295,7 +295,7 @@ const updateCredentialsController: AppController = async (c) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const keys = Object.keys(result.data);
|
const keys = Object.keys(result.data);
|
||||||
let event: NostrEvent;
|
let event: NostrEvent | undefined;
|
||||||
|
|
||||||
if (keys.length === 1 && keys[0] === 'pleroma_settings_store') {
|
if (keys.length === 1 && keys[0] === 'pleroma_settings_store') {
|
||||||
event = (await store.query([{ kinds: [0], authors: [pubkey] }]))[0];
|
event = (await store.query([{ kinds: [0], authors: [pubkey] }]))[0];
|
||||||
|
|
@ -350,6 +350,10 @@ const updateCredentialsController: AppController = async (c) => {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!event) {
|
||||||
|
return c.json({ error: 'Account not found.' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
const settingsStore = result.data.pleroma_settings_store;
|
const settingsStore = result.data.pleroma_settings_store;
|
||||||
const account = await renderAccount(event, { withSource: true, settingsStore });
|
const account = await renderAccount(event, { withSource: true, settingsStore });
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue