Fix 5 wrong API endpoints + stop swallowing JS errors in E2E
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 10s
Test / e2e-test (push) Successful in 4m24s
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 3s
PR Preview / test (pull_request) Successful in 4s
PR Preview / deploy-preview (pull_request) Successful in 10s
Test / e2e-test (push) Successful in 4m24s
Endpoint fixes: - AuditLog: /api/audit-logs → /api/audit-log - BugTracker: /api/bugs → /api/bug-reports, create → /api/bug-report - BugTracker: fix create body (content+priority, not title/description) - MyDiary: /api/brand-settings → /api/brand - MyDiary: /api/me/display-name → PUT /api/me - RecipeSearch: /api/category-modules → /api/categories Test improvements: - Remove blanket uncaught:exception swallow (only ignore ResizeObserver) - Add endpoint-parity.cy.js: intercept-based test that verifies correct API endpoints are called and wrong ones are NOT called Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -154,7 +154,7 @@ function formatDetail(log) {
|
||||
async function fetchLogs() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await api(`/api/audit-logs?offset=${page.value * pageSize}&limit=${pageSize}`)
|
||||
const res = await api(`/api/audit-log?offset=${page.value * pageSize}&limit=${pageSize}`)
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
const items = Array.isArray(data) ? data : data.logs || data.items || []
|
||||
@@ -179,7 +179,7 @@ async function undoLog(log) {
|
||||
if (!ok) return
|
||||
try {
|
||||
const id = log._id || log.id
|
||||
const res = await api(`/api/audit-logs/${id}/undo`, { method: 'POST' })
|
||||
const res = await api(`/api/audit-log/${id}/undo`, { method: 'POST' })
|
||||
if (res.ok) {
|
||||
ui.showToast('已撤销')
|
||||
// Refresh
|
||||
|
||||
@@ -188,7 +188,7 @@ function toggleComments(bug) {
|
||||
|
||||
async function loadBugs() {
|
||||
try {
|
||||
const res = await api('/api/bugs')
|
||||
const res = await api('/api/bug-reports')
|
||||
if (res.ok) {
|
||||
bugs.value = await res.json()
|
||||
}
|
||||
@@ -200,14 +200,11 @@ async function loadBugs() {
|
||||
async function createBug() {
|
||||
if (!bugForm.title.trim()) return
|
||||
try {
|
||||
const res = await api('/api/bugs', {
|
||||
const res = await api('/api/bug-report', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
title: bugForm.title.trim(),
|
||||
description: bugForm.description.trim(),
|
||||
priority: bugForm.priority,
|
||||
status: 'open',
|
||||
reporter: auth.user.display_name || auth.user.username,
|
||||
content: bugForm.title.trim() + (bugForm.description.trim() ? '\n' + bugForm.description.trim() : ''),
|
||||
priority: bugForm.priority === 'urgent' ? 0 : bugForm.priority === 'high' ? 1 : 2,
|
||||
}),
|
||||
})
|
||||
if (res.ok) {
|
||||
@@ -226,7 +223,7 @@ async function createBug() {
|
||||
async function updateStatus(bug, newStatus) {
|
||||
const id = bug._id || bug.id
|
||||
try {
|
||||
const res = await api(`/api/bugs/${id}`, {
|
||||
const res = await api(`/api/bug-reports/${id}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ status: newStatus }),
|
||||
})
|
||||
@@ -244,7 +241,7 @@ async function removeBug(bug) {
|
||||
if (!ok) return
|
||||
const id = bug._id || bug.id
|
||||
try {
|
||||
const res = await api(`/api/bugs/${id}`, { method: 'DELETE' })
|
||||
const res = await api(`/api/bug-reports/${id}`, { method: 'DELETE' })
|
||||
if (res.ok) {
|
||||
bugs.value = bugs.value.filter(b => (b._id || b.id) !== id)
|
||||
ui.showToast('已删除')
|
||||
@@ -258,7 +255,7 @@ async function addComment(bug) {
|
||||
if (!newComment.value.trim()) return
|
||||
const id = bug._id || bug.id
|
||||
try {
|
||||
const res = await api(`/api/bugs/${id}/comments`, {
|
||||
const res = await api(`/api/bug-reports/${id}/comments`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
text: newComment.value.trim(),
|
||||
|
||||
@@ -341,7 +341,7 @@ function formatDate(d) {
|
||||
// Brand settings
|
||||
async function loadBrandSettings() {
|
||||
try {
|
||||
const res = await api('/api/brand-settings')
|
||||
const res = await api('/api/brand')
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
brandName.value = data.brand_name || ''
|
||||
@@ -356,7 +356,7 @@ async function loadBrandSettings() {
|
||||
|
||||
async function saveBrandSettings() {
|
||||
try {
|
||||
await api('/api/brand-settings', {
|
||||
await api('/api/brand', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({
|
||||
brand_name: brandName.value,
|
||||
@@ -400,7 +400,7 @@ async function handleUpload(type, event) {
|
||||
// Account
|
||||
async function updateDisplayName() {
|
||||
try {
|
||||
await api('/api/me/display-name', {
|
||||
await api('/api/me', {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ display_name: displayName.value }),
|
||||
})
|
||||
|
||||
@@ -131,7 +131,7 @@ const catTrack = ref(null)
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await api('/api/category-modules')
|
||||
const res = await api('/api/categories')
|
||||
if (res.ok) {
|
||||
categories.value = await res.json()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user