salix-front/src/composables/usePrintService.js

37 lines
847 B
JavaScript
Raw Normal View History

2022-11-17 07:04:12 +00:00
import { useSession } from './useSession';
import axios from 'axios';
import { useQuasar } from 'quasar';
export function usePrintService() {
const quasar = useQuasar();
2024-03-28 06:20:54 +00:00
const { getTokenMultimedia } = useSession();
2022-11-17 07:04:12 +00:00
function sendEmail(path, params) {
return axios.post(path, params).then(() =>
quasar.notify({
message: 'Notification sent',
type: 'positive',
icon: 'check',
})
);
}
function openReport(path, params) {
params = Object.assign(
{
2024-03-28 06:20:54 +00:00
access_token: getTokenMultimedia(),
2022-11-17 07:04:12 +00:00
},
params
);
const query = new URLSearchParams(params).toString();
window.open(`api/${path}?${query}`);
}
return {
sendEmail,
openReport,
};
}