Fix: User Portal deployment - add put function, portal backend, frontend build fix
This commit is contained in:
1 parent
144af68a0a
commit
66e8b633ea
3 files changed
+521
No files matched your search
@@ -65,6 +65,21 @@ function post<T>(endpoint: string, body?: any): Promise<{ code: number; data: T;
|
||||
});
|
||||
}
|
||||
|
||||
export async function put<T>(endpoint: string, body?: any): Promise<T> {
|
||||
const token = localStorage.getItem('aiflow_token');
|
||||
const res = await fetch(API_BASE + endpoint, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
},
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
return res.json();
|
||||
}
|
||||
|
||||
|
||||
// PUT请求
|
||||
function put<T>(endpoint: string, body?: any): Promise<{ code: number; data: T; message: string }> {
|
||||
return request<T>(endpoint, {
|
||||
|
||||
Reference in new issue
Block a user