upd: upload gambar

Deskripsi:
- upload gambar create banner
- nb : susahhh, blm selesai

No Issues
This commit is contained in:
amel
2025-05-14 17:36:23 +08:00
parent 6b3de4d6b2
commit a877eec078
4 changed files with 11 additions and 9 deletions

View File

@@ -9,7 +9,7 @@ import { Entypo } from "@expo/vector-icons";
import * as ImagePicker from 'expo-image-picker';
import { router, Stack } from "expo-router";
import { useState } from "react";
import { Image, Pressable, SafeAreaView, ScrollView, Text, View } from "react-native";
import { Image, Platform, Pressable, SafeAreaView, ScrollView, Text, View } from "react-native";
import { useDispatch } from "react-redux";
export default function CreateBanner() {
@@ -34,14 +34,16 @@ export default function CreateBanner() {
}
};
console.log(imgForm)
const handleCreateEntity = async () => {
const hasil = await decryptToken(String(token?.current))
const fd = new FormData()
fd.append("file", JSON.stringify({
uri: imgForm.uri,
type: 'image/jpeg', // or response.assets[0].type
type: imgForm.mimeType,
name: imgForm.fileName,
size: imgForm.fileSize,
}))
fd.append("data", JSON.stringify(
{
@@ -50,7 +52,8 @@ export default function CreateBanner() {
}
))
const createdEntity = await apiCreateBanner(fd);
dispatch(addEntity(createdEntity));
// console.log('cliene',createdEntity)
// dispatch(addEntity(createdEntity));
};
return (