assessment-artific/front-end/composables/api.ts

7 lines
330 B
TypeScript

import oboe from "oboe";
export async function streamRequest(path: string, callback: oboe.CallbackSignature, onFail: Function, onSuccess: Function) {
const runtimeConfig = useRuntimeConfig();
return oboe(`${runtimeConfig.public.apiBaseUrl}${path}`).node({ 'items.*': callback }).fail(_ => onFail()).done(_ => onSuccess());
}