Introduced Functions Composable
This commit is contained in:
27
composables/useFunctions.js
Normal file
27
composables/useFunctions.js
Normal file
@@ -0,0 +1,27 @@
|
||||
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}
|
||||
}
|
||||
Reference in New Issue
Block a user