feat: refactor document URL retrieval for atestados and licencas
- Updated the document URL fetching logic in the +page.svelte file to use a new query method, enhancing the retrieval process. - Added a new query in atestadosLicencas.ts to obtain stored document URLs, improving authentication checks and error handling. - Streamlined the user experience by ensuring URLs are fetched correctly and opened in a new tab when available.
This commit is contained in:
@@ -1173,9 +1173,9 @@
|
||||
class="btn btn-xs btn-ghost"
|
||||
onclick={async () => {
|
||||
try {
|
||||
const url = await client.storage.getUrl(
|
||||
atestado.documentoId as any
|
||||
);
|
||||
const url = await client.query(api.atestadosLicencas.obterUrlDocumento, {
|
||||
storageId: atestado.documentoId as any,
|
||||
});
|
||||
if (url) {
|
||||
window.open(url, "_blank");
|
||||
} else {
|
||||
@@ -1240,9 +1240,9 @@
|
||||
class="btn btn-xs btn-ghost"
|
||||
onclick={async () => {
|
||||
try {
|
||||
const url = await client.storage.getUrl(
|
||||
licenca.documentoId as any
|
||||
);
|
||||
const url = await client.query(api.atestadosLicencas.obterUrlDocumento, {
|
||||
storageId: licenca.documentoId as any,
|
||||
});
|
||||
if (url) {
|
||||
window.open(url, "_blank");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user