import { reactive, ref } from "vue";

function useRemote() {
  const loading = ref(false);

  async function remoteMethod(query, callback) {
    if (!query) return;

    loading.value = true;
    await callback(query);
    loading.value = false;
  }

  return { loading, remoteMethod };
}

export default useRemote;
