fix(results): 🐛 useLogs returns nothing
This commit is contained in:
@ -2,9 +2,13 @@ import { Log } from 'db'
|
||||
import { fetcher } from 'services/utils'
|
||||
import useSWR from 'swr'
|
||||
|
||||
export const useLogs = (resultId?: string, onError?: (e: Error) => void) => {
|
||||
export const useLogs = (
|
||||
typebotId: string,
|
||||
resultId?: string,
|
||||
onError?: (e: Error) => void
|
||||
) => {
|
||||
const { data, error } = useSWR<{ logs: Log[] }>(
|
||||
resultId ? `/api/typebots/t/results/${resultId}/logs` : null,
|
||||
resultId ? `/api/typebots/${typebotId}/results/${resultId}/logs` : null,
|
||||
fetcher
|
||||
)
|
||||
if (error && onError) onError(error)
|
||||
|
Reference in New Issue
Block a user