upd: upload gambar
Deskripsi: - upload gambar create banner - nb : susahhh, blm selesai No Issues
This commit is contained in:
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user