refac
This commit is contained in:
1 parent
11f52921dc
commit
a641325707
6 files changed
+98
-15
No files matched your search
@@ -308,6 +308,40 @@ export const putOrchestratorPolicy = async (
|
||||
return res;
|
||||
};
|
||||
|
||||
/**
|
||||
* Verify a terminal server connection via the backend proxy.
|
||||
* Used for system/admin connections to avoid CORS issues and API key exposure.
|
||||
*/
|
||||
export const verifyTerminalServerConnection = async (token: string, connection: object) => {
|
||||
let error = null;
|
||||
|
||||
const res = await fetch(`${WEBUI_API_BASE_URL}/configs/terminal_servers/verify`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
...connection
|
||||
})
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) throw await res.json();
|
||||
return res.json();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
error = err.detail;
|
||||
return null;
|
||||
});
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
export const verifyToolServerConnection = async (token: string, connection: object) => {
|
||||
let error = null;
|
||||
|
||||
|
||||
Reference in new issue
Block a user