Initial AlphaPulse implementation: news crawler and Binance klines
- Backend (FastAPI, SQLAlchemy 2, Alembic): single-admin cookie auth, news/crawler/market APIs with SSE and WebSocket streaming - Crawler (Scrapy + Scrapy-Redis): wscn_news, wscn_live, cls_depth, cls_telegraph spiders, idempotent upserts with revisions, raw response archiving, per-source subprocess supervision, restart and backoff - Market worker: full-history Binance spot/USD-M kline backfill, realtime WS stream, hourly and on-reconnect catch-up - Frontend (Vue 3, Element Plus, UnoCSS, KLineChart): news feed, crawler console with live logs, Binance-style chart page - Deploy: docker compose, nginx site, migrate and daily backup scripts
This commit is contained in:
commit
aabc81ba5b
88 files changed
+12603
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import axios from "axios"
|
||||
import { ElMessage } from "element-plus"
|
||||
import { router } from "@/router"
|
||||
|
||||
// 鉴权靠 httpOnly cookie,同源请求自动携带
|
||||
export const http = axios.create({ baseURL: "/api", timeout: 15000 })
|
||||
|
||||
http.interceptors.response.use(
|
||||
response => response.data,
|
||||
(error) => {
|
||||
const url = error.config?.url
|
||||
// /auth/me 的 401 由路由守卫处理;其余接口 401 说明登录过期
|
||||
if (error.response?.status === 401 && url !== "/auth/login") {
|
||||
if (url !== "/auth/me")
|
||||
router.replace({ name: "login", query: { redirect: router.currentRoute.value.fullPath } })
|
||||
} else {
|
||||
ElMessage.error(error.response?.data?.detail ?? error.message)
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
Reference in new issue
Block a user