27 lines
827 B
JavaScript
27 lines
827 B
JavaScript
import axios from "axios";
|
|
import dayjs from "dayjs";
|
|
|
|
const baseURL = "https://functions.fedeo.io"
|
|
|
|
export const useFunctions = () => {
|
|
const supabase = useSupabaseClient()
|
|
|
|
const getWorkingTimesEvaluationData = async (profileId, startDate, endDate) => {
|
|
const {data:{session:{access_token}}} = await supabase.auth.getSession()
|
|
|
|
return (await axios({
|
|
method: "POST",
|
|
url: `${baseURL}/functions/workingtimeevaluation`,
|
|
data: {
|
|
profile: profileId,
|
|
startDate: dayjs(startDate).format("YYYY-MM-DD"),
|
|
endDate: dayjs(endDate).format("YYYY-MM-DD"),
|
|
},
|
|
headers: {
|
|
Authorization: `Bearer ${access_token}`
|
|
}
|
|
})).data
|
|
}
|
|
|
|
return {getWorkingTimesEvaluationData}
|
|
} |