feat: hecha la parte de gestion de propiedades en venta
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user