changed form reset and fixed systemvoice
This commit is contained in:
@ -33,7 +33,7 @@ export async function updatePlayerMapIcon(mapIconId?: number) {
|
||||
}
|
||||
|
||||
if (mapIconId === undefined) {
|
||||
throw new Error("nameplateId is required");
|
||||
throw new Error("map icon is required");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -51,7 +51,7 @@ export async function updatePlayerMapIcon(mapIconId?: number) {
|
||||
|
||||
return updatePlayerMapIconId;
|
||||
} catch (error) {
|
||||
console.error("Error updating nameplate:", error);
|
||||
console.error("Error updating map icon:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
@ -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) => {
|
||||
|
Reference in New Issue
Block a user