feat: hecha la parte de gestion de propiedades en venta

This commit is contained in:
2025-02-01 18:10:24 -03:00
parent af231344b6
commit 2a8ba5a9f4
9 changed files with 257 additions and 10 deletions

View File

@@ -7,6 +7,7 @@
import { urlG } from "../stores/urlStore";
import ModalPublicarPropiedadParaVenta from "./ModalPublicarPropiedadParaVenta.svelte";
import type { setVenta } from "../types";
let modal: boolean = $state(false);
let modalpayload: string = $state("");
@@ -41,8 +42,27 @@
function setventa() {
showPublicarVenta = true;
}
async function sendMod() {
async function sendMod(data:setVenta) {
data.idpropiedad = id;
try {
const responce = await fetch(String($urlG)+"/api/propiedad/setPropiedadAVenta", {
method: "PUT",
headers:{
'Auth' : String(sessionStorage.getItem("token")),
'Content-Type': "application/json",
},
body: JSON.stringify(data),
});
if(responce.ok){
window.location.reload();
}
const json = await responce.json();
modalpayload = json.message;
modal = true;
}catch (e){
console.error(e);
}
}
</script>