zdjęcia pobierają się na głównej stronie + naprawiono kilka innych bugów.

takich jak wyświetlanie "Moich ogłoszeń nie dla poprawnego id etc."
This commit is contained in:
2025-06-08 22:31:52 +02:00
parent bcce392c9b
commit 2218c5eb33
8 changed files with 172 additions and 164 deletions

View File

@@ -1,6 +1,6 @@
import { useNoticesStore } from "@/store/noticesStore";
import { NoticeCard } from "@/components/NoticeCard";
import { Button, ButtonIcon, ButtonText } from "@/components/ui/button";
import { Button, ButtonText } from "@/components/ui/button";
import { Box } from "@/components/ui/box";
import { Text } from "@/components/ui/text";
@@ -12,15 +12,17 @@ import { Linking } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { useToast, Toast, ToastTitle } from "@/components/ui/toast";
import { AppState } from "react-native";
import { useAuthStore } from "@/store/authStore";
export default function UserNotices() {
const { notices, fetchNotices, deleteNotice } = useNoticesStore();
const [isLoading, setIsLoading] = useState(true);
const [isRedirecting, setIsRedirecting] = useState(false);
const currentUserId = 1;
const toast = useToast();
const appState = useRef(AppState.currentState);
const [toastId, setToastId] = useState(0);
const { user_id } = useAuthStore.getState();
const currentUserId= user_id;
useEffect(() => {
if (!isRedirecting) return;
@@ -28,9 +30,9 @@ export default function UserNotices() {
if (state === "active") {
setIsRedirecting(false);
const paymentStatus = "CORRECT";
if (paymentStatus == "INCORRECT") {
if (paymentStatus === "INCORRECT") {
showNewToast("Płatność została anulowana.");
} else if (paymentStatus == "CORRECT") {
} else if (paymentStatus === "CORRECT") {
showNewToast("Płatność została zrealizowana.");
} else {
showNewToast("Płatność jeszcze nie wpłynęła.");
@@ -83,7 +85,7 @@ export default function UserNotices() {
const paymentResult = await createPayment(); //trzeba dodać orderId
if (paymentResult) {
setIsRedirecting(true);
Linking.openURL(paymentResult);
await Linking.openURL(paymentResult);
setWaitingForPayment(true);
} else {
console.log(`Nie udało się aktywować ogłoszenia ${noticeId}.`);