ahora esta la gestion de permisos

This commit is contained in:
2025-04-22 21:00:58 -03:00
parent e118a3acd2
commit eeb2ff1c65
5 changed files with 117 additions and 36 deletions

View File

@@ -8,6 +8,8 @@
import BotonEsquina from "../Componentes/BotonEsquina.svelte";
import ModalEditarPermiso from "../Componentes/ModalEditarPermiso.svelte";
import Login from "./login.svelte";
import { Modal } from "@sveltestrap/sveltestrap";
import ModalLogs from "../Componentes/ModalLogs.svelte";
const token: string = sessionStorage.getItem("token") || "";
@@ -60,12 +62,48 @@
}
}
function NuevoPermiso(a: PermisoDto): void {
throw new Error("Function not implemented.WIP");
async function NuevoPermiso(a: PermisoDto) {
let b = a;
try {
const req = await fetch($urlG + "/api/permisos", {
method: "POST",
headers: {
Auth: token,
"Content-Type": "application/json",
},
body: JSON.stringify(b),
});
if (req.ok) {
obtenerPermisos();
return;
}
modaldat = "Hubieron problemas creando el permiso";
return;
} catch {
modaldat = "Fallo al hacer la request";
}
}
function PatchPermiso(): void {
throw new Error("Function not implemented.WIP");
async function PatchPermiso(a: PermisoDto) {
let b = a;
try {
const req = await fetch($urlG + "/api/permisos", {
method: "PATCH",
headers: {
Auth: token,
"Content-Type": "application/json",
},
body: JSON.stringify(b),
});
if (req.ok) {
obtenerPermisos();
return;
}
modaldat = "Hubieron problemas editando el permiso";
return;
} catch {
modaldat = "Fallo al hacer la request";
}
}
</script>