Skip to content

Commit

Permalink
User util: Improve extension load speed (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon authored Aug 25, 2024
1 parent 2e37784 commit a4b7192
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/utils/user.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { apiFetch } from './tumblr_helpers.js';

const fetchedUserInfo = await apiFetch('/v2/user/info').catch((error) => {
console.error(error);
return { response: {} };
});

const fetchedCommunitiesInfo = await apiFetch('/v2/communities').catch((error) => {
console.error(error);
return { response: [] };
});
const [
fetchedUserInfo,
fetchedCommunitiesInfo
] = await Promise.all([
apiFetch('/v2/user/info').catch((error) => {
console.error(error);
return { response: {} };
}),
apiFetch('/v2/communities').catch((error) => {
console.error(error);
return { response: [] };
})
]);

/**
* {object?} userInfo - The contents of the /v2/user/info API endpoint
Expand Down

0 comments on commit a4b7192

Please sign in to comment.