renamed SearchResponse to ServiceItem in frontend

This commit is contained in:
2026-06-30 04:55:08 +02:00
parent 3086b7e2ca
commit baa0582d50
3 changed files with 29 additions and 22 deletions
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState, type SyntheticEvent } from 'react'
import '../ui/Modal.scss'
import { type PagedSearchResponse, type SearchResponse, type SearchRequest } from '../../types/search'
import { type PagedSearchResponse, type ServiceItem, type SearchRequest } from '../../types/search'
import { search } from '../../api/searches'
import type { ServiceType } from '../../types/connection'
@@ -14,11 +14,13 @@ interface Props {
export function SearchModal({ serviceType, label, appUrl, username, onClose }: Readonly<Props>) {
const [query, setQuery] = useState('')
const [results, setResults] = useState<PagedSearchResponse<SearchResponse> | null>(null)
const [results, setResults] = useState<PagedSearchResponse<ServiceItem> | null>(null)
const [loading, setLoading] = useState(false)
const [error, setError] = useState<string | null>(null)
//TODO: implement aiSearch
const [aiSearch, setAiSearch] = useState(false);
const firstInputRef = useRef<HTMLInputElement>(null)
const dialogRef = useRef<HTMLDialogElement>(null)
useEffect(() => {
@@ -41,7 +43,7 @@ export function SearchModal({ serviceType, label, appUrl, username, onClose }: R
setError(null)
setLoading(true)
try {
const req: SearchRequest = { appUrl, serviceType, username, query}
const req: SearchRequest = { appUrl, serviceType, username, query, aiSearch}
const res = await search(req)
console.log(req)
setResults(res)