ahora esta la gestion de permisos
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user