implementado hasta el ultimo paso antes de hacer la tercera notificacion
This commit is contained in:
@@ -2,15 +2,19 @@
|
||||
import type { PropiedadDto } from "../types";
|
||||
import ModalConfirm from "./ModalConfirm.svelte";
|
||||
import {urlG} from "../stores/urlStore";
|
||||
import ModalEstatico from "./ModalEstatico.svelte";
|
||||
|
||||
let { prop }: { prop: PropiedadDto } = $props();
|
||||
|
||||
let show: boolean = $state(false);
|
||||
let token = sessionStorage.getItem("token");
|
||||
let remitente = localStorage.getItem("email");
|
||||
const accion = "Nuevo Alquiler";
|
||||
let modaldata = $state("");
|
||||
let mensaje = `Alquiler: ${prop.ubicacion} a ${remitente}`;
|
||||
|
||||
const message: string = "Queres consultar con el propietario por el alquiler? (esto le envia una notificacion y email al propietario)";
|
||||
const accion = "Consulta Nuevo Alquiler";
|
||||
|
||||
|
||||
function Consultar() {
|
||||
show = true;
|
||||
@@ -19,14 +23,18 @@
|
||||
async function onConfirm() {
|
||||
const propiedad = prop.id;
|
||||
try {
|
||||
const responce = await fetch($urlG+"/api/notificaciones", {
|
||||
const responce = await fetch($urlG+"/api/notificaciones/consultaAlquiler", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Auth": String(token)
|
||||
"Auth": String(token),
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body : JSON.stringify({remitente, accion, propiedad})
|
||||
body : JSON.stringify({remitente, accion, mensaje, propiedad})
|
||||
});
|
||||
if (responce.ok){
|
||||
let data = await responce.json();
|
||||
|
||||
}
|
||||
} catch {
|
||||
|
||||
}
|
||||
@@ -40,6 +48,11 @@
|
||||
|
||||
</script>
|
||||
|
||||
{#if modaldata}
|
||||
<ModalEstatico payload={modaldata} close={()=>!!(modaldata = "")} />
|
||||
{/if}
|
||||
|
||||
|
||||
<ModalConfirm {show} {message} title="Consulta" {onConfirm} {onCancel}/>
|
||||
<div class="card text-center border shadow-sm">
|
||||
<div class="card-header bg-primary text-white">
|
||||
|
||||
Reference in New Issue
Block a user