# fix
- authentication
- profile
- pencarian user
- forum
## No issue
This commit is contained in:
2024-05-20 10:55:13 +08:00
parent 66b9902d97
commit dbeb740d1f
58 changed files with 1374 additions and 386 deletions

View File

@@ -128,17 +128,7 @@ export default function CreateProfile({ userId }: { userId: any }) {
<Stack>
<ComponentKatalog_NotedBox informasi="Upload foto latar belakang profile anda." />
<AspectRatio ratio={16 / 9}>
<Paper
radius={"md"}
withBorder
shadow="lg"
bg={"gray.2"}
// sx={{
// borderStyle: "solid",
// borderColor: "black",
// borderWidth: "1px",
// }}
>
<Paper radius={"md"} withBorder shadow="lg" bg={"gray.2"}>
{imgBG ? (
<Image alt="Foto" src={imgBG ? imgBG : "/aset/no-img.png"} />
) : (
@@ -197,6 +187,7 @@ export default function CreateProfile({ userId }: { userId: any }) {
<TextInput
withAsterisk
label="Nama"
maxLength={50}
placeholder="Nama lengkap"
onChange={(val) => {
setValue({
@@ -209,6 +200,7 @@ export default function CreateProfile({ userId }: { userId: any }) {
withAsterisk
icon={<IconAt size={15} />}
label="Email"
maxLength={100}
placeholder="Contoh: User@gmail.com"
error={
value.email.length > 0 && !value.email.match(validRegex)
@@ -225,8 +217,8 @@ export default function CreateProfile({ userId }: { userId: any }) {
<TextInput
withAsterisk
label="Alamat"
maxLength={100}
placeholder="Alamat lengkap"
error={value.alamat.length > 100 ? "Max 100 karakter" : ""}
onChange={(val) => {
setValue({
...value,
@@ -288,7 +280,6 @@ function ButtonAction({
if (_.values(body).includes(""))
return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data");
if (!body.email.match(validRegex)) return null;
if (body.alamat.length > 100) return null;
const gambarPP = new FormData();
gambarPP.append("filePP", filePP as any);

View File

@@ -19,6 +19,7 @@ import { Profile_funEditById } from "../fun/update/fun_edit_profile_by_id";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { validRegex } from "../../component/regular_expressions";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
const router = useRouter();
@@ -31,10 +32,8 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
const body = dataProfile;
// console.log(body)
if (_.values(body).includes(""))
return ComponentGlobal_NotifikasiPeringatan("Lengkapi data");
if (_.values(body).includes("")) return null;
if (!body.email.match(validRegex)) return null;
if (body.alamat.length > 100) return null;
await Profile_funEditById(body).then((res) => {
if (res.status === 200) {
@@ -77,7 +76,6 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
value={dataProfile?.User?.username}
onChange={(val) => {
// const dataUsername = _.clone(dataProfile)
setDataProfile({
...(dataProfile as any),
User: {
@@ -90,7 +88,15 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
<TextInput
withAsterisk
label="Nama"
placeholder="Nama"
placeholder="nama"
maxLength={50}
error={
dataProfile?.name === "" ? (
<ComponentGlobal_ErrorInput text="Masukan nama" />
) : (
""
)
}
value={dataProfile?.name}
onChange={(val) => {
setDataProfile({
@@ -105,10 +111,14 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
label="Email"
placeholder="email"
error={
dataProfile?.email?.length > 0 &&
!dataProfile?.email.match(validRegex)
? "Invalid email"
: ""
dataProfile?.email === "" ? (
<ComponentGlobal_ErrorInput text="Masukan email " />
) : dataProfile?.email?.length > 0 &&
!dataProfile?.email.match(validRegex) ? (
<ComponentGlobal_ErrorInput text="Invalid email" />
) : (
""
)
}
value={dataProfile?.email}
onChange={(val) => {
@@ -124,7 +134,14 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) {
label="Alamat"
placeholder="alamat"
value={dataProfile.alamat}
error={dataProfile.alamat.length > 100 ? "Max 100 karakter" : ""}
maxLength={100}
error={
dataProfile?.alamat === "" ? (
<ComponentGlobal_ErrorInput text="Masukan alamat " />
) : (
""
)
}
onChange={(val) => {
setDataProfile({
...dataProfile,