hyxfish27 / AttackOnGame

聚人 AttackOnGame
https://attack-on-game.vercel.app
1 stars 2 forks source link

[教練feedback]待超過 3 秒鐘就直會返回 timeout of 3000ms exceeded 的 error #39

Open eee317 opened 1 month ago

eee317 commented 1 month ago

前端 axios 有設置等待超過 3 秒鐘就直會返回 timeout of 3000ms exceeded 這個 error 建議針對超時這塊的 error handle 多做一些提示,不然一開始註冊時 email 跟密碼都有符合要求,但因為 API 超時(render 還在睡)的關係,註冊失敗的當下會有點疑惑

eee317 commented 2 weeks ago

目前大大們想到的解決方式

方式1. html

{{ errorMessage }}

js

await EventAPI.getEvents(query) .then((res) => { rawEventData.value = res.data; }) .catch((err) => { rawEventData.value = []; errorMessage.value = err?.data?.message || '連線逾時,靜待雲端伺服器睡醒'; })

可寫在這個位置

image 參考的 CSS https://cssloaders.github.io/

方式2. 頁面的最外層加一個modal,控制的變數放在pinia,跳error的時候更改pinia的值讓modal出現 image

方式3 修改 API 的檔案,只要有噴這個錯誤就另外跳窗 隱憂:不知道會不會對其他目前已經處理的頁面造成其他問題