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

7 lines
330 B
TypeScript
Raw Normal View History

import oboe from "oboe";
2024-10-31 12:00:19 +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();
return oboe(`${runtimeConfig.public.apiBaseUrl}${path}`).node({ 'items.*': callback }).fail(_ => onFail()).done(_ => onSuccess());
2024-10-31 12:00:19 +00:00
}