zdjęcia naprawione po raz drugi
This commit is contained in:
@@ -73,9 +73,7 @@ export async function getAllImagesByNoticeId(noticeId) {
|
|||||||
const { token } = useAuthStore.getState();
|
const { token } = useAuthStore.getState();
|
||||||
const headers = token ? { Authorization: `Bearer ${token}` } : {};
|
const headers = token ? { Authorization: `Bearer ${token}` } : {};
|
||||||
try {
|
try {
|
||||||
const listResponse = await axios.get(`${API_URL}/images/list/${noticeId}`, {
|
const listResponse = await axios.get(`${API_URL}/images/list/${noticeId}`, {headers: headers});
|
||||||
headers: headers,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (listResponse.data && listResponse.data.length > 0) {
|
if (listResponse.data && listResponse.data.length > 0) {
|
||||||
return listResponse.data.map((imageName) => ({
|
return listResponse.data.map((imageName) => ({
|
||||||
@@ -112,7 +110,7 @@ export const uploadImage = async (noticeId, imageUri) => {
|
|||||||
const type = match ? `image/${match[1]}` : "image/jpeg";
|
const type = match ? `image/${match[1]}` : "image/jpeg";
|
||||||
|
|
||||||
formData.append("file", {
|
formData.append("file", {
|
||||||
uri: imageUri.uri,
|
uri: imageUri,
|
||||||
name: filename,
|
name: filename,
|
||||||
type: type,
|
type: type,
|
||||||
});
|
});
|
||||||
@@ -129,6 +127,7 @@ export const uploadImage = async (noticeId, imageUri) => {
|
|||||||
return response.data;
|
return response.data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("imageURI:", imageUri);
|
console.log("imageURI:", imageUri);
|
||||||
|
|
||||||
console.error(
|
console.error(
|
||||||
"Error uploading image:",
|
"Error uploading image:",
|
||||||
error.response.data,
|
error.response.data,
|
||||||
|
|||||||
Reference in New Issue
Block a user