5 Commits

Author SHA1 Message Date
2d0f5b9e56 Merge remote-tracking branch 'origin/main' 2025-06-13 22:32:45 +02:00
dd73dc070d little mistake fix 2025-06-13 22:32:31 +02:00
7efe9d91c3 dumb fix 2025-06-13 18:17:42 +02:00
67cf21230d images were uploaded doubled 2025-06-13 17:58:14 +02:00
945d225a9f mały fix odnośnie błędu na starcie aplikacji 2025-06-12 10:13:20 +02:00
4 changed files with 18 additions and 14 deletions

View File

@@ -42,8 +42,10 @@ export async function createNotice(notice) {
for (const image of notice.image) { for (const image of notice.image) {
if (notice.image.indexOf(image) === 0) { if (notice.image.indexOf(image) === 0) {
await uploadImage(response.data.noticeId, image, true); await uploadImage(response.data.noticeId, image, true);
} else {
await uploadImage(response.data.noticeId, image, false);
} }
await uploadImage(response.data.noticeId, image, false); console.log("Image uploaded successfully");
} }
} }
@@ -125,7 +127,7 @@ export const uploadImage = async (noticeId, imageObj, isFirst) => {
headers: headers, headers: headers,
} }
); );
console.info("Upload successful:", response.data); console.log("Upload successful:", response.data);
return response.data; return response.data;
} catch (error) { } catch (error) {
console.error( console.error(
@@ -180,7 +182,7 @@ export const editNotice = async (noticeId, notice) => {
if (response.data && notice.image && notice.image.length > 0) { if (response.data && notice.image && notice.image.length > 0) {
for (let i = 0; i < notice.image.length; i++) { for (let i = 0; i < notice.image.length; i++) {
const image = notice.image[i]; const image = notice.image[i];
const isFirst = i == 0; const isFirst = i === 0;
if (typeof image === "string" && !image.startsWith("http")) { if (typeof image === "string" && !image.startsWith("http")) {
await uploadImage(noticeId, image, isFirst); await uploadImage(noticeId, image, isFirst);

View File

@@ -44,7 +44,7 @@ export default function Account() {
<Image <Image
source={{ source={{
uri: uri:
user.profileImage || user.image ||
"https://th.bing.com/th/id/OIP.3coo_N8sieled8QNroQmkgHaHa?rs=1&pid=ImgDetMain", "https://th.bing.com/th/id/OIP.3coo_N8sieled8QNroQmkgHaHa?rs=1&pid=ImgDetMain",
}} }}
className="h-24 w-24 rounded-full border-4 border-white shadow-md" className="h-24 w-24 rounded-full border-4 border-white shadow-md"

View File

@@ -15,21 +15,21 @@ export default function Home() {
const [isReady, setIsReady] = useState(false); const [isReady, setIsReady] = useState(false);
const fetchNotices = useNoticesStore((state) => state.fetchNotices); const fetchNotices = useNoticesStore((state) => state.fetchNotices);
// useEffect(() => { useEffect(() => {
// setIsReady(true); setIsReady(true);
// }, []); }, []);
// useEffect(() => { useEffect(() => {
// if (isReady && !token) { if (isReady && !token) {
// router.replace("/login"); router.replace("/login");
// } }
// }, [isReady, token, router]); }, [isReady, token, router]);
useEffect(() => { useEffect(() => {
if (token) { if (token) {
fetchNotices(); fetchNotices();
} }
}, [token, fetchNotices]); }, [token]);
const notices = useNoticesStore((state) => state.notices); const notices = useNoticesStore((state) => state.notices);

View File

@@ -20,7 +20,9 @@ export function UserSection({ notices, title }) {
} }
}; };
fetchUsers(); if (token) {
fetchUsers();
}
}, [token]); }, [token]);
const usersWithNoticeCount = const usersWithNoticeCount =