changed form reset and fixed systemvoice

This commit is contained in:
Polaris
2024-08-26 20:06:33 -04:00
parent bfe2403076
commit e22708f98a
9 changed files with 19 additions and 79 deletions

View File

@ -64,7 +64,7 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
try {
const data = await getCurrentMapIcon();
if (data.length > 0) {
setMapIconId(data[0].mapIconId ?? undefined); // Handle null as undefined
setMapIconId(data[0].mapIconId ?? undefined);
form.setValue("mapIconId", data[0].mapIconId as number);
}
} catch (error) {
@ -82,22 +82,15 @@ export const MapIconCustomization: FC<SystemVoiceSelectionProps> = ({
updatePlayerMapIcon(newMapIconId).then(() => {
setMapIconId(newMapIconId);
});
resetFormValues();
toast({
title: "You submitted the following values:",
description: (
<pre className="mt-2 w-[340px] rounded-md bg-slate-950 p-4">
<code className="text-white">{JSON.stringify(data, null, 2)}</code>
<pre className="mt-2 w-[340px] rounded-md p-4">
<div className="text-white">Map icon updated</div>
</pre>
),
});
function resetFormValues() {
form.reset({
mapIconId: undefined,
});
}
}
const getTexture = (id: number | undefined, defaultSrc: string) => {