skeleton para pagina grupo creado por usuario
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
import BuscarVentas from "./paginas/BuscarVentas.svelte";
|
import BuscarVentas from "./paginas/BuscarVentas.svelte";
|
||||||
import MisPropiedadesEnVenta from "./paginas/MisPropiedadesEnVenta.svelte";
|
import MisPropiedadesEnVenta from "./paginas/MisPropiedadesEnVenta.svelte";
|
||||||
import AdminGrupos from "./paginas/AdminGrupos.svelte";
|
import AdminGrupos from "./paginas/AdminGrupos.svelte";
|
||||||
|
import OtroG from "./paginas/grupos/OtroG.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Router>
|
<Router>
|
||||||
@@ -151,6 +152,9 @@
|
|||||||
<Route path="/grupo/Informes">
|
<Route path="/grupo/Informes">
|
||||||
<ProteRoute componente={FrontInformes} />
|
<ProteRoute componente={FrontInformes} />
|
||||||
</Route>
|
</Route>
|
||||||
|
<Route path="/grupo/:id" let:params>
|
||||||
|
<ProteRoute componente={{ OtroG, params }} />
|
||||||
|
</Route>
|
||||||
|
|
||||||
<!--Notificaciones-->
|
<!--Notificaciones-->
|
||||||
<Route path="/notificaciones">
|
<Route path="/notificaciones">
|
||||||
|
|||||||
@@ -1,55 +1,59 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from "svelte";
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from "svelte/store";
|
||||||
|
|
||||||
import { urlG } from "../stores/urlStore";
|
import { urlG } from "../stores/urlStore";
|
||||||
|
|
||||||
let { componente } = $props();
|
let { componente } = $props();
|
||||||
|
|
||||||
const isAuthenticated = writable(false);
|
|
||||||
const isVerified = writable(false);
|
|
||||||
|
|
||||||
const redirect = window.location.pathname;
|
|
||||||
const email = localStorage.getItem('email');
|
|
||||||
const token = sessionStorage.getItem('token');
|
|
||||||
|
|
||||||
const handleAccess = async () => {
|
|
||||||
try {
|
|
||||||
const response = await fetch($urlG+"/api/login/validar", {
|
|
||||||
method: 'POST',
|
|
||||||
headers: {
|
|
||||||
'Auth': String(token),
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
},
|
|
||||||
body: JSON.stringify({ email, redirect }),
|
|
||||||
credentials: "include"
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.ok) {
|
const isAuthenticated = writable(false);
|
||||||
isAuthenticated.set(true); // Actualiza el store
|
const isVerified = writable(false);
|
||||||
}
|
|
||||||
} catch (error) {
|
const redirect = window.location.pathname;
|
||||||
console.error('Error durante la autenticación:', error);
|
const email = localStorage.getItem("email");
|
||||||
} finally {
|
const token = sessionStorage.getItem("token");
|
||||||
isVerified.set(true); // Marca la verificación como completada
|
|
||||||
}
|
const handleAccess = async () => {
|
||||||
};
|
try {
|
||||||
|
const response = await fetch($urlG + "/api/login/validar", {
|
||||||
onMount(() => {
|
method: "POST",
|
||||||
handleAccess();
|
headers: {
|
||||||
});
|
Auth: String(token),
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ email, redirect }),
|
||||||
|
credentials: "include",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.ok) {
|
||||||
|
isAuthenticated.set(true); // Actualiza el store
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error durante la autenticación:", error);
|
||||||
|
} finally {
|
||||||
|
isVerified.set(true); // Marca la verificación como completada
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
handleAccess();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !$isVerified}
|
{#if !$isVerified}
|
||||||
<div class="d-flex justify-content-center position-absolute top-50 start-50">
|
<div
|
||||||
<div class="spinner-border" role="status">
|
class="d-flex justify-content-center position-absolute top-50 start-50"
|
||||||
<span class="visually-hidden">Loading...</span>
|
>
|
||||||
</div>
|
<div class="spinner-border" role="status">
|
||||||
</div>
|
<span class="visually-hidden">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else if $isAuthenticated}
|
||||||
|
{#if typeof componente === "object" && componente !== null}
|
||||||
|
{@render componente.OtroG(componente.params)}
|
||||||
|
{:else}
|
||||||
|
{@render componente()}
|
||||||
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
{#if $isAuthenticated}
|
{window.location.replace("/")}
|
||||||
{@render componente()}
|
{/if}
|
||||||
{:else}
|
|
||||||
{window.location.replace('/')}
|
|
||||||
{/if}
|
|
||||||
{/if}
|
|
||||||
|
|||||||
13
Front/src/paginas/grupos/OtroG.svelte
Normal file
13
Front/src/paginas/grupos/OtroG.svelte
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import ListaAcciones from "../../Componentes/ListaAcciones.svelte";
|
||||||
|
import NavBarAutocompletable from "../../Componentes/NavBarAutocompletable.svelte";
|
||||||
|
let { id }: { id: string } = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<NavBarAutocompletable />
|
||||||
|
<div class="container mt-5">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h1>Menu grupo: {id}</h1>
|
||||||
|
</div>
|
||||||
|
<ListaAcciones />
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user