2024-10-31 15:41:45 +00:00
|
|
|
import oboe from "oboe";
|
2024-10-31 12:00:19 +00:00
|
|
|
|
2024-10-31 15:41:45 +00:00
|
|
|
export async function streamRequest(path: string, callback: oboe.CallbackSignature, onFail: Function, onSuccess: Function) {
|
2024-10-31 12:00:19 +00:00
|
|
|
const runtimeConfig = useRuntimeConfig();
|
2024-10-31 15:41:45 +00:00
|
|
|
return oboe(`${runtimeConfig.public.apiBaseUrl}${path}`).node({ 'items.*': callback }).fail(_ => onFail()).done(_ => onSuccess());
|
2024-10-31 12:00:19 +00:00
|
|
|
}
|