Fix async/await

This commit is contained in:
Lim Chee Aun 2023-10-20 20:54:24 +08:00
parent 137ad7f4dd
commit 66f9c3b918

View file

@ -30,9 +30,9 @@ const supportsInputMonth = (() => {
} }
})(); })();
function _isSearchEnabled(instance) { async function _isSearchEnabled(instance) {
const { masto } = api({ instance }); const { masto } = api({ instance });
const results = masto.v2.search.fetch({ const results = await masto.v2.search.fetch({
q: 'from:me', q: 'from:me',
type: 'statuses', type: 'statuses',
limit: 1, limit: 1,
@ -72,6 +72,7 @@ function AccountStatuses() {
if (!account?.acct) return; if (!account?.acct) return;
(async () => { (async () => {
const enabled = await isSearchEnabled(instance); const enabled = await isSearchEnabled(instance);
console.log({ enabled });
setSearchEnabled(enabled); setSearchEnabled(enabled);
})(); })();
}, [instance, sameCurrentInstance, account?.acct]); }, [instance, sameCurrentInstance, account?.acct]);