Compare commits

..

2 Commits

Author SHA1 Message Date
gitea-actions
4cf00e6ef3 chore: bump version to v0.1.3
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m10s
2026-02-09 19:49:58 +00:00
5be33abb03 fix : correction de l'impression des absences + ajout d'un favicon
All checks were successful
Auto Tag Develop / tag (push) Successful in 5s
2026-02-09 20:49:47 +01:00
7 changed files with 23 additions and 12 deletions

View File

@@ -5,7 +5,7 @@ nelmio_cors:
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
allow_credentials: true
expose_headers: ['Link']
expose_headers: ['Link', 'Content-Disposition']
max_age: 3600
paths:
'^/': null

View File

@@ -1,2 +1,2 @@
parameters:
app.version: '0.1.2'
app.version: '0.1.3'

View File

@@ -4,9 +4,14 @@ import { useAuthStore } from '~/stores/auth'
export type AnyObject = Record<string, unknown>
export type BlobResponse = {
data: Blob
headers: Headers
}
export type ApiClient = {
get<T>(url: string, query?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
getBlob(url: string, query?: AnyObject, options?: ApiFetchOptions<'blob'>): Promise<Blob>
getBlob(url: string, query?: AnyObject, options?: ApiFetchOptions<'blob'>): Promise<BlobResponse>
post<T>(url: string, body?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
put<T>(url: string, body?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
patch<T>(url: string, body?: AnyObject, options?: ApiFetchOptions<'json'>): Promise<T>
@@ -165,7 +170,9 @@ export const useApi = (): ApiClient => {
return request<T>('GET', url, { ...options, query })
},
getBlob(url: string, query: AnyObject = {}, options: ApiFetchOptions<'blob'> = {}) {
return client<Blob>(url, { ...options, method: 'GET', query, responseType: 'blob' })
return client
.raw(url, { ...options, method: 'GET', query, responseType: 'blob' })
.then((res) => ({ data: res._data as Blob, headers: res.headers }))
},
post<T>(url: string, body: AnyObject = {}, options: ApiFetchOptions<'json'> = {}) {
return request<T>('POST', url, { ...options, body })

View File

@@ -4,16 +4,17 @@ export const usePdfPrinter = () => {
const api = useApi()
const printPdf = async (url: string): Promise<void> => {
const blob = await api.getBlob(url);
const res = await api.getBlob(url);
const disposition = res.headers.get('content-disposition') || '';
const match = disposition.match(/filename="(.+?)"/i);
const filename = match?.[1] ?? 'document.pdf';
const pdfBlob = blob.type === 'application/pdf'
? blob
: new Blob([blob], { type: 'application/pdf' });
const pdfBlob = res.data.type === 'application/pdf'
? res.data
: new Blob([res.data], { type: 'application/pdf' });
const blobUrl = URL.createObjectURL(pdfBlob);
const filename = `test.pdf`;
const a = document.createElement('a');
a.href = blobUrl;
a.download = filename;

View File

@@ -63,7 +63,6 @@ const handleSubmit = async () => {
isSubmitting.value = true
try {
console.log(useRuntimeConfig().public.apiBase)
await auth.login(username.value, password.value)
await router.push('/')

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -78,7 +78,11 @@ class AbsencePrintProvider implements ProviderInterface
$dompdf->setPaper('A3', 'landscape');
$dompdf->render();
$filename = 'test';
$filename = sprintf(
'absences_du_%s_au_%s.pdf',
$fromDate->format('d-m-Y'),
$toDate->format('d-m-Y')
);
return new Response($dompdf->output(), Response::HTTP_OK, [
'Content-Type' => 'application/pdf',