import { useSession } from './useSession'; import axios from 'axios'; import { useQuasar } from 'quasar'; export function usePrintService() { const quasar = useQuasar(); const { getTokenMultimedia } = useSession(); function sendEmail(path, params) { return axios.post(path, params).then(() => quasar.notify({ message: 'Notification sent', type: 'positive', icon: 'check', }) ); } function openReport(path, params) { if (typeof params === 'string') params = JSON.parse(params); params = Object.assign( { access_token: getTokenMultimedia(), }, params ); const query = new URLSearchParams(params).toString(); window.open(`api/${path}?${query}`); } return { sendEmail, openReport, }; }