Little fix of parameters for image selection

This commit is contained in:
2025-05-02 14:47:26 +02:00
parent b8ca34f736
commit 37c273a746
2 changed files with 9 additions and 7 deletions

View File

@@ -1,8 +1,8 @@
import axios from "axios"; import axios from "axios";
import FormData from 'form-data' import FormData from 'form-data'
// const API_URL = "https://testowe.zikor.pl/api/v1"; const API_URL = "https://testowe.zikor.pl/api/v1";
const API_URL = "http://172.20.10.2:8080/api/v1"; // const API_URL = "http://172.20.10.2:8080/api/v1";
export async function listNotices() { export async function listNotices() {
const response = await fetch(`${API_URL}/notices/get/all`); const response = await fetch(`${API_URL}/notices/get/all`);

View File

@@ -22,7 +22,7 @@ import {
import { ChevronDownIcon } from "@/components/ui/icon"; import { ChevronDownIcon } from "@/components/ui/icon";
import { useMutation } from "@tanstack/react-query"; import { useMutation } from "@tanstack/react-query";
import {createNotice, uploadImage} from "@/api/notices"; import {createNotice} from "@/api/notices";
export default function CreateNotice() { export default function CreateNotice() {
const [title, setTitle] = useState(""); const [title, setTitle] = useState("");
@@ -65,7 +65,7 @@ export default function CreateNotice() {
console.log("Notice created successfully"); console.log("Notice created successfully");
}, },
onError: (error) => { onError: (error) => {
console.error("Error creating notice"); console.error("Error creating notice. Erroe message: ", error.message);
}, },
}); });
@@ -87,10 +87,12 @@ export default function CreateNotice() {
const pickImage = async () => { const pickImage = async () => {
// No permissions request is necessary for launching the image library // No permissions request is necessary for launching the image library
let result = await ImagePicker.launchImageLibraryAsync({ let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ['images', 'videos'], mediaTypes: ['images'],
allowsEditing: true, selectionLimit: 8,
allowsEditing: false,
allowsMultipleSelection: true,
aspect: [4, 3], aspect: [4, 3],
quality: 1, quality: 0.5,
}); });
if (!result.canceled) { if (!result.canceled) {