add edit notice and clean code
This commit is contained in:
@@ -54,10 +54,8 @@ export default function NoticeDetails() {
|
||||
|
||||
const handleSendMessage = async () => {
|
||||
setIsSending(true);
|
||||
console.log("Rozpoczynanie procesu wysyłania wiadomości...");
|
||||
|
||||
const { user_id, token } = useAuthStore.getState();
|
||||
console.log("Dane z authStore:", { user_id, token });
|
||||
|
||||
if (!user_id || !token) {
|
||||
console.error("Brak danych zalogowanego użytkownika.");
|
||||
@@ -68,9 +66,7 @@ export default function NoticeDetails() {
|
||||
|
||||
let currentUserEmail = "";
|
||||
try {
|
||||
console.log(`Pobieranie danych użytkownika dla user_id : $ { user_id }`);
|
||||
const currentUser = await getUserById(user_id);
|
||||
console.log("Dane zalogowanego użytkownika:", currentUser);
|
||||
currentUserEmail = currentUser?.email;
|
||||
if (!currentUserEmail) {
|
||||
console.error("Nie znaleziono adresu email zalogowanego użytkownika.");
|
||||
@@ -81,8 +77,6 @@ export default function NoticeDetails() {
|
||||
setIsSending(false);
|
||||
return;
|
||||
}
|
||||
console.log(`Pobrano email zalogowanego użytkownika
|
||||
: $ { currentUserEmail }`);
|
||||
} catch (error) {
|
||||
console.error("Błąd podczas pobierania danych użytkownika:", error);
|
||||
Alert.alert(
|
||||
@@ -98,7 +92,6 @@ export default function NoticeDetails() {
|
||||
subject: `Zapytanie ${currentUserEmail} o ogłoszenie ${notice.title}`,
|
||||
body: message,
|
||||
};
|
||||
console.log("Dane emaila do wysyłki:", emailData);
|
||||
|
||||
if (!emailData.to || !emailData.subject || !emailData.body) {
|
||||
console.error("Walidacja nieudana: brakujące pola w emailData.");
|
||||
@@ -109,7 +102,6 @@ export default function NoticeDetails() {
|
||||
|
||||
const result = await sendEmail(emailData);
|
||||
if (result.success) {
|
||||
console.log("Wiadomość wysłana pomyślnie!", result.result);
|
||||
setIsMessageFormVisible(false);
|
||||
setMessage("");
|
||||
Alert.alert("Sukces", "Wiadomość została wysłana!");
|
||||
@@ -122,7 +114,6 @@ export default function NoticeDetails() {
|
||||
);
|
||||
}
|
||||
setIsSending(false);
|
||||
console.log("Zakończono proces wysyłania wiadomości.");
|
||||
};
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
|
||||
Reference in New Issue
Block a user