客户端和服务端分离 api 目标,少点走公网
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -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: {
|
||||
|
||||
@ -14,7 +14,8 @@ let blogs: ListBlogItemType[] = []
|
||||
|
||||
try {
|
||||
blogs = await listBlogs({ page, limit: 100 })
|
||||
} catch {
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return Astro.redirect('/500')
|
||||
}
|
||||
---
|
||||
|
||||
@ -22,6 +22,7 @@ let blogData = null
|
||||
try {
|
||||
blogData = await getBlog(blog_id_num)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
return Astro.redirect('/500')
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user