Merge pull request #104 from bipproduction/profile/upload

Fix: Profile
This commit is contained in:
Bagasbanuna02
2024-09-25 14:22:29 +08:00
committed by GitHub

View File

@@ -1,5 +1,6 @@
"use client"; "use client";
import { MainColor } from "@/app_modules/_global/color";
import { import {
ComponentGlobal_BoxInformation, ComponentGlobal_BoxInformation,
ComponentGlobal_BoxUploadImage, ComponentGlobal_BoxUploadImage,
@@ -21,10 +22,8 @@ import {
} from "@mantine/core"; } from "@mantine/core";
import { IconAt, IconCamera, IconUpload } from "@tabler/icons-react"; import { IconAt, IconCamera, IconUpload } from "@tabler/icons-react";
import { useState } from "react"; import { useState } from "react";
import { Profile_ComponentCreateNewProfile } from "../_component";
import { validRegex } from "../../component"; import { validRegex } from "../../component";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; import { Profile_ComponentCreateNewProfile } from "../_component";
import { MainColor } from "@/app_modules/_global/color";
export default function CreateProfile() { export default function CreateProfile() {
const [filePP, setFilePP] = useState<File | null>(null); const [filePP, setFilePP] = useState<File | null>(null);
@@ -84,15 +83,8 @@ export default function CreateProfile() {
const buffer = URL.createObjectURL( const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())]) new Blob([new Uint8Array(await files.arrayBuffer())])
); );
if (files.size > 2000000) { setImgPP(buffer);
ComponentGlobal_NotifikasiPeringatan( setFilePP(files);
"Maaf, Ukuran file terlalu besar, maximum 2mb",
3000
);
} else {
setImgPP(buffer);
setFilePP(files);
}
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
@@ -146,17 +138,8 @@ export default function CreateProfile() {
const buffer = URL.createObjectURL( const buffer = URL.createObjectURL(
new Blob([new Uint8Array(await files.arrayBuffer())]) new Blob([new Uint8Array(await files.arrayBuffer())])
); );
if (files.size > 2000000) { setImgBG(buffer);
ComponentGlobal_NotifikasiPeringatan( setFileBG(files);
"Maaf, Ukuran file terlalu besar, maximum 2mb",
3000
);
} else {
setImgBG(buffer);
setFileBG(files);
}
// console.log(buffer, "ini buffer");
// console.log(files, " ini file");
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }