Skip to content

Commit

Permalink
Fix: List updating
Browse files Browse the repository at this point in the history
Signed-off-by: SeaSide53 <[email protected]>
  • Loading branch information
SeaSide53 committed Oct 27, 2024
1 parent 2e5d285 commit ac75589
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pages/list/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const ListPage: NextPage<PageProps> = ({ data }) => {
}
};

const submitHandle: FormEventHandler = useCallback(
const editHandle: FormEventHandler = useCallback(
(e) => {
(async () => {
e.preventDefault();
Expand All @@ -182,7 +182,11 @@ const ListPage: NextPage<PageProps> = ({ data }) => {
const res = await fetch(`/api/list/${encodeURIComponent(data.id)}/update`, {
method: "POST",
body: JSON.stringify({
...data,
title: data.title,
description: data.description,
gameVersion: data.gameVersion,
modloader: data.modloader,
visibility: data.visibility,
mods: resolvedMods.map((elem) => richModToMod(elem)),
}),
headers: { "Content-Type": "application/json" },
Expand Down Expand Up @@ -610,7 +614,7 @@ ${
{hasElevatedPermissions && (
<div className="mb-16 flex flex-wrap items-center gap-2">
{isEditing ? (
<Button variant="green" onClick={submitHandle} disabled={isSaving}>
<Button variant="green" onClick={editHandle} disabled={isSaving}>
{isSaving ? <Spinner className="block h-5 w-5" /> : <SaveIcon className="block h-5 w-5" />}
<span>Save</span>
</Button>
Expand Down

0 comments on commit ac75589

Please sign in to comment.