termine lo que corresponde a logear los contratos
This commit is contained in:
@@ -41,7 +41,7 @@
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Contrato</h5>
|
||||
<button type="button" class="btn-close" onclick={onClose}></button>
|
||||
<button type="button" class="btn-close" onclick={onClose} aria-label="Cerrar"></button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
import { navigate } from "svelte-routing";
|
||||
|
||||
let isOpen: boolean = $state(false);
|
||||
|
||||
let hayNotis:boolean = $state(false);
|
||||
|
||||
const permisos = writable<Grupo[]>([]);
|
||||
const email = localStorage.getItem('email');
|
||||
const token = sessionStorage.getItem('token');
|
||||
@@ -38,8 +39,28 @@
|
||||
|
||||
onMount( () => {
|
||||
obtenerPermisos();
|
||||
obtenerNotis();
|
||||
})
|
||||
|
||||
async function obtenerNotis() {
|
||||
try {
|
||||
const responce = await fetch($urlG+"/api/notificaciones/haySinLeer", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
}
|
||||
});
|
||||
if(responce.ok) {
|
||||
let data = await responce.json();
|
||||
hayNotis = data.message;
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function redirijir(path: string){
|
||||
navigate(path);
|
||||
}
|
||||
@@ -70,8 +91,15 @@
|
||||
<img src="/toggle-right.svg" alt=""/>
|
||||
{/if}
|
||||
</button>
|
||||
<button class="badge btn btn-info" onclick={()=>navigate("/notificaciones")}>
|
||||
<img src="/bell.svg" alt="">
|
||||
<button class="badge btn btn-info position-relative" onclick={()=>navigate("/notificaciones")}>
|
||||
<img src="/bell.svg" alt="">
|
||||
{#if hayNotis}
|
||||
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
|
||||
!
|
||||
<span class="visually-hidden">unread messages</span>
|
||||
</span>
|
||||
{/if}
|
||||
|
||||
</button>
|
||||
</div>
|
||||
<NavbarToggler on:click={() => (isOpen = !isOpen)} />
|
||||
|
||||
Reference in New Issue
Block a user