8 lines
287 B
JavaScript
8 lines
287 B
JavaScript
import { getCurrentInstance, withAsyncContext as withVueAsyncContext } from "vue";
|
|
export function withAsyncContext(fn) {
|
|
return withVueAsyncContext(() => {
|
|
const nuxtApp = getCurrentInstance()?.appContext.app.$nuxt;
|
|
return nuxtApp ? nuxtApp.runWithContext(fn) : fn();
|
|
});
|
|
}
|