Skip to content

Commit

Permalink
reload
Browse files Browse the repository at this point in the history
  • Loading branch information
supreme2580 committed Dec 18, 2024
1 parent 42eba12 commit 42ea806
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions frontend/src/tabs/worlds/WorldsCreationPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ const WorldsCreationPanel = (props) => {
const submitStart = isCompetitionWorld ? getCompetitionStart() : start;
const submitEnd = isCompetitionWorld ? getCompetitionEnd() : end;

// Check if there are any existing worlds
const surroundingResponse = await fetchWrapper('get-all-worlds');
const isFirstWorld =
!surroundingResponse.data || surroundingResponse.data.length === 0;

if (!devnetMode) {
await createWorldCall(
worldName,
Expand All @@ -230,7 +235,13 @@ const WorldsCreationPanel = (props) => {
submitStart,
submitEnd
);
// Redirect will happen in createWorldCall

if (isFirstWorld) {
window.location.href = `/worlds/${worldSlug}`;
} else {
closePanel();
props.setActiveTab('Worlds');
}
return;
}

Expand All @@ -253,8 +264,12 @@ const WorldsCreationPanel = (props) => {
});
if (response.result) {
console.log(response.result);
// Redirect to the new world in devnet mode too
window.location.href = `/worlds/${worldSlug}`;
if (isFirstWorld) {
window.location.href = `/worlds/${worldSlug}`;
} else {
closePanel();
props.setActiveTab('Worlds');
}
}
};

Expand Down

0 comments on commit 42ea806

Please sign in to comment.