@@ -1,5 +1,5 @@
|
||||
import { Link } from "@inertiajs/react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
export default function PartnershipSearchResults({ query }: { query: string }) {
|
||||
const [items, setItems] = useState<{ id: number; title: string }[]>([]);
|
||||
useEffect(() => {
|
||||
@@ -8,9 +8,9 @@ export default function PartnershipSearchResults({ query }: { query: string }) {
|
||||
return;
|
||||
}
|
||||
const controller = new AbortController();
|
||||
fetch("/api/v1/partnerships?q=" + encodeURIComponent(query), {
|
||||
fetch('/api/v1/partnerships?q=' + encodeURIComponent(query), {
|
||||
signal: controller.signal,
|
||||
headers: { Accept: "application/json" },
|
||||
headers: { Accept: 'application/json' },
|
||||
})
|
||||
.then((r) => (r.ok ? r.json() : null))
|
||||
.then((data) => setItems(data?.data ?? []))
|
||||
@@ -23,14 +23,14 @@ export default function PartnershipSearchResults({ query }: { query: string }) {
|
||||
<h2 className="text-xl font-bold">Parcerias nesta pesquisa</h2>
|
||||
{items.slice(0, 5).map((item) => (
|
||||
<p key={item.id}>
|
||||
<Link className="underline" href={"/parcerias/" + item.id}>
|
||||
<Link className="underline" href={'/parcerias/' + item.id}>
|
||||
{item.title}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
<Link
|
||||
className="underline"
|
||||
href={"/parcerias?q=" + encodeURIComponent(query)}
|
||||
href={'/parcerias?q=' + encodeURIComponent(query)}
|
||||
>
|
||||
Ver todas as parcerias correspondentes
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user