import { fetchEventSource } from '@microsoft/fetch-event-source' const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run' export default (url, { onmessage, onerror, controller, params }) => { const token = useCookie('token') fetchEventSource(`${BASE_URL}${url}`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept': '*/*', 'Authorization': token.value }, body: JSON.stringify(params), onopen (response) { const status = response.status useRequestError(status) }, onmessage (info) { onmessage(info) }, onerror (error) { onerror(error) }, openWhenHidden: true, signal: controller && controller.signal }) }