mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-12-14 16:16:21 +00:00
Update terminal-panel.tsx
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import type React from "react"
|
import type React from "react"
|
||||||
import { useEffect, useRef, useState } from "react"
|
import { useEffect, useRef, useState } from "react"
|
||||||
import { API_PORT } from "@/lib/api-config"
|
import { API_PORT } from "../lib/api-config"
|
||||||
import {
|
import {
|
||||||
Activity,
|
Activity,
|
||||||
Trash2,
|
Trash2,
|
||||||
@@ -226,11 +226,19 @@ export const TerminalPanel: React.FC<TerminalPanelProps> = ({ websocketUrl, onCl
|
|||||||
setIsSearching(true)
|
setIsSearching(true)
|
||||||
|
|
||||||
const apiUrl = getApiUrl()
|
const apiUrl = getApiUrl()
|
||||||
|
const token = typeof window !== "undefined" ? localStorage.getItem("proxmenux-auth-token") : null
|
||||||
|
|
||||||
|
const headers: Record<string, string> = {
|
||||||
|
Accept: "application/json",
|
||||||
|
}
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
headers["Authorization"] = `Bearer ${token}`
|
||||||
|
}
|
||||||
|
|
||||||
const response = await fetch(`${apiUrl}/api/terminal/search-command?q=${encodeURIComponent(query)}`, {
|
const response = await fetch(`${apiUrl}/api/terminal/search-command?q=${encodeURIComponent(query)}`, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers,
|
||||||
Accept: "application/json",
|
|
||||||
},
|
|
||||||
signal: AbortSignal.timeout(10000),
|
signal: AbortSignal.timeout(10000),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user