@ -90,7 +90,8 @@ export interface SsgPopularBrand {
|
||||
|
||||
// ===================== base 解析 =====================
|
||||
|
||||
export function getBase(): string {
|
||||
// 仅本模块内部使用(toAbs / request 等),不对外导出。
|
||||
function getBase(): string {
|
||||
// if (import.meta.env.DEV) return "https://seo.23cm.cn"
|
||||
// 运行期/预渲染统一走 BASE_API(空则同源相对 /api)
|
||||
return (BASE_API || "").replace(/\/$/, "")
|
||||
@ -192,7 +193,8 @@ async function request<T>(path: string, params?: URLSearchParams): Promise<T> {
|
||||
// 接口:GET /api/public/runway-looks/:id
|
||||
// 走秀详情(含完整图片集)。base 默认走 ssrBase()(运行期按需渲染取数),也可显式传入。
|
||||
// locale 显式传入时优先(按需渲染 SSR 用它避免并发串 locale),否则走 currentLocale()。
|
||||
export async function fetchArticleById(
|
||||
// 仅本模块内部使用(getSsrArticle 在其之上包一层),不对外导出。
|
||||
async function fetchArticleById(
|
||||
id: number | string,
|
||||
base: string = ssrBase(),
|
||||
locale?: string
|
||||
@ -327,12 +329,9 @@ export async function fetchMe(): Promise<AuthUser | null> {
|
||||
}
|
||||
}
|
||||
|
||||
// 登录/注册成功后写入本地会话(token + user),供 Layout 顶部已登录态与 fetchMe 读取。
|
||||
export function saveSession(token: string, user: AuthUser): void {
|
||||
if (typeof localStorage === "undefined") return
|
||||
localStorage.setItem(TOKEN_KEY, token)
|
||||
localStorage.setItem(USER_KEY, JSON.stringify(user))
|
||||
}
|
||||
// 注:saveSession(登录/注册成功后写 token+user 进 localStorage)已移除——
|
||||
// 站点没有登录注册入口,后端 POST /auth/register、POST /auth/login 也已下线。
|
||||
// 将来接入时恢复此函数,并补回后端注册/登录接口与前端表单。
|
||||
|
||||
// ===================== SSG 构建专用(/api/ssg/*,仅 Node 构建期) =====================
|
||||
|
||||
@ -442,7 +441,8 @@ export async function getStreetSnaps(q: {
|
||||
|
||||
// 接口:GET /api/public/street-snaps/:id
|
||||
// 街拍详情(含完整图片集)。base 默认走 ssrBase()(运行期按需渲染取数)。
|
||||
export async function fetchStreetSnapById(
|
||||
// 仅本模块内部使用(getSsrStreetSnap 在其之上包一层),不对外导出。
|
||||
async function fetchStreetSnapById(
|
||||
id: number | string,
|
||||
base: string = ssrBase(),
|
||||
locale?: string
|
||||
|
||||
Reference in New Issue
Block a user