客户端和服务端分离 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'
|
import axios from 'axios'
|
||||||
|
|
||||||
export const legacyClient = axios.create({
|
export const legacyClient = axios.create({
|
||||||
// baseURL: import.meta.env.SSR
|
baseURL: import.meta.env.SSR
|
||||||
// ? 'https://legacy.passthem.top/api'
|
? ((await import('astro:env/server')) as any)['LEGACY_BACKEND_URL_SSR']
|
||||||
// : '/api/legacy',
|
: 'https://legacy.passthem.top/api',
|
||||||
baseURL: 'https://legacy.passthem.top/api',
|
// baseURL: 'https://legacy.passthem.top/api',
|
||||||
timeout: 6000,
|
timeout: 6000,
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -14,7 +14,8 @@ let blogs: ListBlogItemType[] = []
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
blogs = await listBlogs({ page, limit: 100 })
|
blogs = await listBlogs({ page, limit: 100 })
|
||||||
} catch {
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
return Astro.redirect('/500')
|
return Astro.redirect('/500')
|
||||||
}
|
}
|
||||||
---
|
---
|
||||||
|
|||||||
@ -22,6 +22,7 @@ let blogData = null
|
|||||||
try {
|
try {
|
||||||
blogData = await getBlog(blog_id_num)
|
blogData = await getBlog(blog_id_num)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e)
|
||||||
return Astro.redirect('/500')
|
return Astro.redirect('/500')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user