fix(home): show quote skeleton while loading and harden auth/images
Prefer server quote status, avoid false no-quote before ready, toast on 401 re-login, and keep product/banner image URLs absolute. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -60,6 +60,7 @@ _axios.interceptors.response.use(
|
||||
|
||||
if (response?.status === 401) {
|
||||
removeToken()
|
||||
showPleaseLoginAgain()
|
||||
const routeName = router.currentRoute.value.name
|
||||
const isPublicRoute =
|
||||
router.currentRoute.value.meta?.public === true ||
|
||||
@@ -113,6 +114,19 @@ _axios.interceptors.response.use(
|
||||
const DEFAULT_LOAD_ERROR = 'خطا در بارگذاری اطلاعات'
|
||||
const SERVER_ERROR = 'خطا در برقراری ارتباط با سرور'
|
||||
const NETWORK_ERROR = 'لطفا اینترنت خود را بررسی کنید و مجددا تلاش کنید'
|
||||
const LOGIN_AGAIN = 'لطفا مجددا وارد شوید'
|
||||
let lastAuthToastAt = 0
|
||||
|
||||
function showPleaseLoginAgain() {
|
||||
const now = Date.now()
|
||||
if (now - lastAuthToastAt < 2500) return
|
||||
lastAuthToastAt = now
|
||||
message.error({
|
||||
content: LOGIN_AGAIN,
|
||||
key: 'please-login-again',
|
||||
duration: 3,
|
||||
})
|
||||
}
|
||||
|
||||
function withHttpStatus(message: string, status: number): string {
|
||||
return `${message} (${status})`
|
||||
|
||||
Reference in New Issue
Block a user