auto-sync: 2026-05-19 14:03:20
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { api } from '../api';
|
||||
import { api, _getProjectId } from '../api';
|
||||
import { useStore } from '../store';
|
||||
|
||||
// ── 类型定义(对齐后端 checkpoints 表) ──
|
||||
@@ -57,7 +57,7 @@ function DecisionCheckpoint({
|
||||
if (!selected) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch(`/api/projects/${api._getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/approve`, {
|
||||
const res = await fetch(`/api/projects/${_getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/approve`, {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ resolved_by: 'user', note: `选择: ${selected}${note ? '\n' + note : ''}` }),
|
||||
});
|
||||
@@ -125,7 +125,7 @@ function VerifyCheckpoint({
|
||||
if (action === 'reject' && !showReject) { setShowReject(true); return; }
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch(`/api/projects/${api._getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/${action}`, {
|
||||
const res = await fetch(`/api/projects/${_getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/${action}`, {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ resolved_by: 'user', note: reason }),
|
||||
});
|
||||
@@ -215,7 +215,7 @@ function ActionCheckpoint({
|
||||
if (!allDone) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch(`/api/projects/${api._getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/approve`, {
|
||||
const res = await fetch(`/api/projects/${_getProjectId()}/tasks/${taskId}/checkpoints/${cp.id}/approve`, {
|
||||
method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ resolved_by: 'user', note }),
|
||||
});
|
||||
@@ -291,7 +291,7 @@ export default function CheckpointPanel({
|
||||
const [activeIdx, setActiveIdx] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
const pid = api._getProjectId();
|
||||
const pid = _getProjectId();
|
||||
if (!pid) return;
|
||||
fetch(`/api/projects/${pid}/tasks/${taskId}/checkpoints`)
|
||||
.then(r => r.json())
|
||||
|
||||
Reference in New Issue
Block a user