Fix usuarios page #6
@@ -1173,9 +1173,9 @@
|
|||||||
class="btn btn-xs btn-ghost"
|
class="btn btn-xs btn-ghost"
|
||||||
onclick={async () => {
|
onclick={async () => {
|
||||||
try {
|
try {
|
||||||
const url = await client.storage.getUrl(
|
const url = await client.query(api.atestadosLicencas.obterUrlDocumento, {
|
||||||
atestado.documentoId as any
|
storageId: atestado.documentoId as any,
|
||||||
);
|
});
|
||||||
if (url) {
|
if (url) {
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
} else {
|
} else {
|
||||||
@@ -1240,9 +1240,9 @@
|
|||||||
class="btn btn-xs btn-ghost"
|
class="btn btn-xs btn-ghost"
|
||||||
onclick={async () => {
|
onclick={async () => {
|
||||||
try {
|
try {
|
||||||
const url = await client.storage.getUrl(
|
const url = await client.query(api.atestadosLicencas.obterUrlDocumento, {
|
||||||
licenca.documentoId as any
|
storageId: licenca.documentoId as any,
|
||||||
);
|
});
|
||||||
if (url) {
|
if (url) {
|
||||||
window.open(url, "_blank");
|
window.open(url, "_blank");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -740,6 +740,22 @@ export const generateUploadUrl = mutation({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obter URL de um documento armazenado
|
||||||
|
*/
|
||||||
|
export const obterUrlDocumento = query({
|
||||||
|
args: {
|
||||||
|
storageId: v.id("_storage"),
|
||||||
|
},
|
||||||
|
returns: v.union(v.string(), v.null()),
|
||||||
|
handler: async (ctx, args) => {
|
||||||
|
const usuario = await getUsuarioAutenticado(ctx);
|
||||||
|
if (!usuario) throw new Error("Não autenticado");
|
||||||
|
|
||||||
|
return await ctx.storage.getUrl(args.storageId);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Criar atestado médico
|
* Criar atestado médico
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user