NERDDISCO commited on
Commit
1cb247f
•
1 Parent(s): 24e9313

fix(game-creator): comment out server submit

Browse files
Files changed (1) hide show
  1. src/components/GameCreator.tsx +30 -30
src/components/GameCreator.tsx CHANGED
@@ -197,36 +197,36 @@ export default function GameCreator() {
197
  }
198
  };
199
 
200
- const handleSubmitServer = async (event: React.FormEvent<HTMLFormElement>) => {
201
- event.preventDefault();
202
- const formData = new FormData(event.target as HTMLFormElement);
203
- const formObject = Object.fromEntries(formData);
204
- try {
205
- setLoading(true);
206
-
207
- abortController.current = new AbortController();
208
-
209
- const { data } = await axios.post("/api/generate", formObject, {
210
- signal: abortController.current.signal,
211
- });
212
- const answer = data;
213
-
214
- setAnswers(previousAnswers => [answer, ...previousAnswers]);
215
- setRunningId(answer.id);
216
- setActiveId(answer.id);
217
- setTemplate(prettify(answer.content));
218
- setErrorMessage("");
219
- reload();
220
- } catch (error) {
221
- if ((error as { message?: string }).message !== "canceled") {
222
- const err = error as AxiosError;
223
- console.error(err);
224
- setErrorMessage(err.response?.data?.message ?? err.message);
225
- }
226
- } finally {
227
- setLoading(false);
228
- }
229
- };
230
 
231
  const handleCancel = async () => {
232
  if (abortController.current) {
 
197
  }
198
  };
199
 
200
+ // const handleSubmitServer = async (event: React.FormEvent<HTMLFormElement>) => {
201
+ // event.preventDefault();
202
+ // const formData = new FormData(event.target as HTMLFormElement);
203
+ // const formObject = Object.fromEntries(formData);
204
+ // try {
205
+ // setLoading(true);
206
+
207
+ // abortController.current = new AbortController();
208
+
209
+ // const { data } = await axios.post("/api/generate", formObject, {
210
+ // signal: abortController.current.signal,
211
+ // });
212
+ // const answer = data;
213
+
214
+ // setAnswers(previousAnswers => [answer, ...previousAnswers]);
215
+ // setRunningId(answer.id);
216
+ // setActiveId(answer.id);
217
+ // setTemplate(prettify(answer.content));
218
+ // setErrorMessage("");
219
+ // reload();
220
+ // } catch (error) {
221
+ // if ((error as { message?: string }).message !== "canceled") {
222
+ // const err = error as AxiosError;
223
+ // console.error(err);
224
+ // setErrorMessage(err.response?.data?.message ?? err.message);
225
+ // }
226
+ // } finally {
227
+ // setLoading(false);
228
+ // }
229
+ // };
230
 
231
  const handleCancel = async () => {
232
  if (abortController.current) {