add payment for SaleProprite ,add commsion,fixed error handling fiexd final things
All checks were successful
Build frontend / build (push) Successful in 1m46s

This commit is contained in:
hamzaobed7
2026-08-18 01:24:18 +03:00
parent 5592d9fbd2
commit 3472dc1175
10 changed files with 793 additions and 1070 deletions

View File

@ -1,4 +1,6 @@
import { body } from "framer-motion/client";
import AuthService from "../services/AuthService";
import { frameData } from "framer-motion";
const API_BASE = process.env.NEXT_PUBLIC_API_URL || "https://45.93.137.91.nip.io/api";
const REPORT_API_BASE = process.env.NEXT_PUBLIC_REPORT_API_URL || "http://45.93.137.91/api";
@ -364,16 +366,38 @@ export async function getSalePropertyById(id) {
}
export async function updateRentPropertyStatus(id, status) {
return apiFetch(`/RentProperties/UpdateStatus/${id}`, {
return apiFetch(`/RentProperties/ChangeActivityStatus/${id}`, {
method: "PUT",
body: { status },
body: status ,
});
}
export async function updateSalePropertyStatus(id, status) {
return apiFetch(`/SaleProperties/UpdateStatus/${id}`, {
return apiFetch(`/SaleProperties/ChangeActivityStatus/${id}`, {
method: "PUT",
body: { status },
body: status ,
});
}
export async function OwnerPaymentForSaleProperite(
salePropertyId,
PaymentTypeId,
TransactionType,
paymentImage
) {
const formData = new FormData();
formData.append("salePropertyId", String(salePropertyId));
formData.append("PaymentTypeId", String(PaymentTypeId));
formData.append("TransactionType", String(TransactionType));
if (paymentImage instanceof File) {
formData.append("paymentImage", paymentImage);
}
return apiFetch("/SaleProperties/PaySaleFee", {
method: "POST",
body: formData,
});
}

View File

@ -1,5 +1,6 @@
import { initializeApp, getApps } from "firebase/app";
import { getMessaging, getToken, onMessage } from "firebase/messaging";
import { Cookies } from 'js-cookie';
const firebaseConfig = {
apiKey: "AIzaSyBZV7KBLRJSTApahfrO8lBesmIM3zNRSaY",
@ -45,8 +46,7 @@ export async function requestNotificationPermission() {
// Send token to backend
if (token) {
try {
const authToken = localStorage.getItem("auth_token");
const authToken = Cookies.get(auth_token);
if (authToken) {
const apiBase =
process.env.NEXT_PUBLIC_API_URL ||
@ -66,7 +66,6 @@ export async function requestNotificationPermission() {
}
} catch (err) {}
}
return token;
} catch (err) {
return null;