feat(protese): Modo 1 fatia 1c — gestão do link na UI da clínica (status/acessos/revogar)
Fecha o Modo 1 (link seguro do protético sem conta): - GET /api/protese/os/:id/link/status: link ativo, nº de acessos, último acesso e expiração. - UI (aba Monitoramento, modo clínica): mostra status do link com Copiar / WhatsApp / Revogar e os contadores de acesso/expiração; gera sob demanda. Conversão por herança é nativa (a OS já aponta para o protetico_id do destinatário). Validado em DEV: acessos contados, expiração 60 dias, revogação → status inativo + leitura pública 404. Modo 1 concluído (1a leitura + 1b ação + 1c gestão). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1130,6 +1130,15 @@ export const HybridBackend = {
|
||||
if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error || 'Erro ao gerar link');
|
||||
return await res.json();
|
||||
},
|
||||
getProteseLinkStatus: async (osId: string) => {
|
||||
const res = await apiFetch(`${API_URL}/protese/os/${osId}/link/status`);
|
||||
return await res.json().catch(() => ({ ativo: false }));
|
||||
},
|
||||
revogarProteseLink: async (osId: string) => {
|
||||
const res = await apiFetch(`${API_URL}/protese/os/${osId}/link/revogar`, { method: 'POST' });
|
||||
if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error || 'Erro ao revogar');
|
||||
return await res.json();
|
||||
},
|
||||
// Leitura PÚBLICA via token (sem login — não usa apiFetch/Authorization)
|
||||
getProtesePublic: async (token: string) => {
|
||||
const res = await fetch(`${API_URL}/p/${encodeURIComponent(token)}`);
|
||||
|
||||
Reference in New Issue
Block a user