init notice edit
This commit is contained in:
@@ -11,7 +11,7 @@ import { createOrder, createPayment, getOrder } from "@/api/order";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { useToast, Toast, ToastTitle } from "@/components/ui/toast";
|
||||
import { useAuthStore } from "@/store/authStore";
|
||||
import * as WebBrowser from 'expo-web-browser';
|
||||
import * as WebBrowser from "expo-web-browser";
|
||||
import { useRouter } from "expo-router";
|
||||
|
||||
export default function UserNotices() {
|
||||
@@ -71,17 +71,16 @@ export default function UserNotices() {
|
||||
if (paymentResult) {
|
||||
setIsRedirecting(true);
|
||||
|
||||
|
||||
await WebBrowser.openAuthSessionAsync(paymentResult);
|
||||
|
||||
|
||||
setTimeout(async () => {
|
||||
setIsRedirecting(false);
|
||||
|
||||
try {
|
||||
const lastOrder = await getOrder(result);
|
||||
const lastPayments = lastOrder.payments;
|
||||
const paymentStatus = lastPayments.length > 0
|
||||
const paymentStatus =
|
||||
lastPayments.length > 0
|
||||
? lastPayments[lastPayments.length - 1].status
|
||||
: null;
|
||||
|
||||
@@ -97,7 +96,6 @@ export default function UserNotices() {
|
||||
showNewToast("Nie udało się sprawdzić statusu płatności.");
|
||||
}
|
||||
}, 300);
|
||||
|
||||
} else {
|
||||
console.log(`Nie udało się aktywować ogłoszenia ${noticeId}.`);
|
||||
}
|
||||
@@ -149,17 +147,35 @@ export default function UserNotices() {
|
||||
<Box className="flex-1 mb-4 pb-2 bg-white rounded-lg">
|
||||
<NoticeCard notice={item} />
|
||||
<Box className="flex-row justify-between mt-2">
|
||||
<Button
|
||||
className="ml-2"
|
||||
onPress={() => handleDeleteNotice(item.noticeId)}
|
||||
size="md"
|
||||
variant="outline"
|
||||
action="primary"
|
||||
>
|
||||
<ButtonText>Usuń</ButtonText>
|
||||
<Ionicons name="trash-outline" size={14} />
|
||||
</Button>
|
||||
|
||||
<Box className="flex-row items-center">
|
||||
<Button
|
||||
className="ml-2"
|
||||
onPress={() => handleDeleteNotice(item.noticeId)}
|
||||
size="md"
|
||||
variant="outline"
|
||||
action="primary"
|
||||
>
|
||||
<ButtonText>Usuń</ButtonText>
|
||||
<Ionicons name="trash-outline" size={14} />
|
||||
</Button>
|
||||
{item.status === "INACTIVE" && (
|
||||
<Button
|
||||
className="ml-2"
|
||||
onPress={() => {
|
||||
console.log("Edytuj notice");
|
||||
router.replace(
|
||||
`dashboard/notice/edit/${item.noticeId}`
|
||||
);
|
||||
}}
|
||||
size="md"
|
||||
variant="outline"
|
||||
action="primary"
|
||||
>
|
||||
<ButtonText>Edytuj</ButtonText>
|
||||
<Ionicons name="pencil" size={14} />
|
||||
</Button>
|
||||
)}
|
||||
</Box>
|
||||
{item.status === "ACTIVE" ? (
|
||||
<Button
|
||||
className="mr-2"
|
||||
|
||||
Reference in New Issue
Block a user