import type { Ref } from "vue";

export const withLoading = async <T>(loading_ref: Ref<boolean>, fn: ()=> Promise<T>): Promise<T> => {
    loading_ref.value = true;
    try{
        return await fn();
    } finally {
        loading_ref.value = false;
    }
};