ichieh commited on
Commit
eb8b128
·
1 Parent(s): bf2d715

Fix registration success/failure message handling

Browse files
Files changed (1) hide show
  1. templates/index.html +3 -3
templates/index.html CHANGED
@@ -271,11 +271,11 @@
271
 
272
  const result = await response.json();
273
 
274
- if (result.success) {
275
  await Swal.fire({
276
  icon: 'success',
277
  title: '報名成功',
278
- text: '您已成功報名座位',
279
  confirmButtonText: '確定'
280
  });
281
 
@@ -298,7 +298,7 @@
298
  Swal.fire({
299
  icon: 'error',
300
  title: '報名失敗',
301
- text: result.message || '該座位可能已被其他人選走,請重新選擇',
302
  confirmButtonText: '確定'
303
  });
304
  // 重新載入桌次資料以顯示最新狀態
 
271
 
272
  const result = await response.json();
273
 
274
+ if (response.ok) {
275
  await Swal.fire({
276
  icon: 'success',
277
  title: '報名成功',
278
+ text: result.message || '您已成功報名座位',
279
  confirmButtonText: '確定'
280
  });
281
 
 
298
  Swal.fire({
299
  icon: 'error',
300
  title: '報名失敗',
301
+ text: result.error || '該座位可能已被其他人選走,請重新選擇',
302
  confirmButtonText: '確定'
303
  });
304
  // 重新載入桌次資料以顯示最新狀態