gotta go fast
This commit is contained in:
parent
c253874ce3
commit
1b87f0a396
@ -71,12 +71,10 @@ export default function ReviewButtons(props: ReviewId) {
|
||||
useEffect(() => {
|
||||
async function fetchData() {
|
||||
try {
|
||||
// Fetch user roles
|
||||
const rolesResponse = await fetch("/api/session/roles");
|
||||
const rolesData = parseInt(await rolesResponse.text());
|
||||
// Fetch user roles
|
||||
const userResponse = await fetch("/api/session/user");
|
||||
const userData = await userResponse.json();
|
||||
const [rolesData, userData] = await Promise.all([
|
||||
fetch("/api/session/roles").then(rolesResponse => rolesResponse.text()).then(text => parseInt(text, 10)),
|
||||
fetch("/api/session/user").then(userResponse => userResponse.json())
|
||||
]);
|
||||
|
||||
setRoles(rolesData);
|
||||
setUser(userData.userId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user