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