import { ref } from "vue";
import { getLoadPublic } from "../services/public"

export default function useTrackingLoad() {
    const load = ref(null);
    const loading = ref(false);

    const getLoadTracking = async(id) => {
        
        loading.value = true
        const resp = await getLoadPublic(id);

        if(resp !== null) {
            load.value = resp;
        } else {
            load.value = null;
        }
        loading.value = false;
    }

    return {
        getLoadTracking,
        load,
        loading
    }
}