客户端和服务端分离 api 目标,少点走公网
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-09 16:12:39 +08:00
parent 5e5f13a949
commit bb347dab3b
3 changed files with 7 additions and 5 deletions

View File

@ -1,10 +1,10 @@
import axios from 'axios'
export const legacyClient = axios.create({
// baseURL: import.meta.env.SSR
// ? 'https://legacy.passthem.top/api'
// : '/api/legacy',
baseURL: 'https://legacy.passthem.top/api',
baseURL: import.meta.env.SSR
? ((await import('astro:env/server')) as any)['LEGACY_BACKEND_URL_SSR']
: 'https://legacy.passthem.top/api',
// baseURL: 'https://legacy.passthem.top/api',
timeout: 6000,
withCredentials: true,
headers: {

View File

@ -14,7 +14,8 @@ let blogs: ListBlogItemType[] = []
try {
blogs = await listBlogs({ page, limit: 100 })
} catch {
} catch (e) {
console.error(e)
return Astro.redirect('/500')
}
---

View File

@ -22,6 +22,7 @@ let blogData = null
try {
blogData = await getBlog(blog_id_num)
} catch (e) {
console.error(e)
return Astro.redirect('/500')
}