fix: 修复自选股添加失败 405 错误
- useWatchlist.js: 修正 API 路径从 /api/account/watchlist/add 改为 /api/account/watchlist - account.js: 同步修改 mock handler 路径 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -64,7 +64,7 @@ export const useWatchlist = () => {
|
|||||||
const handleAddToWatchlist = useCallback(async (stockCode, stockName) => {
|
const handleAddToWatchlist = useCallback(async (stockCode, stockName) => {
|
||||||
try {
|
try {
|
||||||
const base = getApiBase();
|
const base = getApiBase();
|
||||||
const resp = await fetch(base + '/api/account/watchlist/add', {
|
const resp = await fetch(base + '/api/account/watchlist', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ export const accountHandlers = [
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
// 6. 添加自选股
|
// 6. 添加自选股
|
||||||
http.post('/api/account/watchlist/add', async ({ request }) => {
|
http.post('/api/account/watchlist', async ({ request }) => {
|
||||||
await delay(NETWORK_DELAY);
|
await delay(NETWORK_DELAY);
|
||||||
|
|
||||||
const currentUser = getCurrentUser();
|
const currentUser = getCurrentUser();
|
||||||
|
|||||||
Reference in New Issue
Block a user