fix: resolve confirmation (#2161)

This commit is contained in:
Yingjie He
2025-04-11 13:58:54 -07:00
committed by GitHub
parent 454e4a47f4
commit 79e65ec3de
10 changed files with 160 additions and 70 deletions
-26
View File
@@ -1,26 +0,0 @@
import { getApiUrl, getSecretKey } from '../config';
export async function ConfirmExtensionRequest(requestId: string, confirmed: boolean) {
try {
const response = await fetch(getApiUrl('/confirm'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Secret-Key': getSecretKey(),
},
body: JSON.stringify({
id: requestId,
confirmed,
principal_type: 'Extension',
}),
});
if (!response.ok) {
const errorText = await response.text();
console.error('Delete response error: ', errorText);
throw new Error('Failed to confirm extension enablement');
}
} catch (error) {
console.error('Error confirming extension enablement: ', error);
}
}
-26
View File
@@ -1,26 +0,0 @@
import { getApiUrl, getSecretKey } from '../config';
export async function ConfirmToolRequest(requesyId: string, action: string) {
try {
const response = await fetch(getApiUrl('/confirm'), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Secret-Key': getSecretKey(),
},
body: JSON.stringify({
id: requesyId,
action,
principal_type: 'Tool',
}),
});
if (!response.ok) {
const errorText = await response.text();
console.error('Delete response error: ', errorText);
throw new Error('Failed to confirm tool');
}
} catch (error) {
console.error('Error confirm tool: ', error);
}
}