Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement edit profile #87

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from "react";
import Button from "@/components/Button";
import ExternalLinkItem from "@/pages/public/Register/ExternalLinkItem";
import ExternalLinkItem from "@/components/ExternalLinkItem";

const SOCIAL_NETWORKS = [
{ name: "accountFacebook", label: "Facebook" },
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/NewReport/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { zodResolver } from "@hookform/resolvers/zod/dist/zod";
import { ErrorMessage } from "@hookform/error-message";
import { toast } from "react-toastify";

const emailListSchema = array(string().email()).nonempty();
const emailListSchema = array(string().email("Adresa de email este invalidă")).nonempty();
const validateEmails = (input: string) => {
const emails = input.trim().split(/\r?\n/); // split input by new line
const emailList = emailListSchema.safeParse(emails);
Expand Down
3 changes: 1 addition & 2 deletions client/src/pages/Profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Profile = () => {
<Section>
<Table
title="Informații despre ONG"
description="Use a permanent address where you can receive mail."
button={<Button to="/profile/edit">Editeaza</Button>}
body={[
["Nume organizație", user.ongName],
Expand All @@ -30,7 +29,7 @@ const Profile = () => {
["Telefon organizație", user.ongName],
[
"Domenii de activitate",
user.domains?.map((domain) => domain.name),
user.domains?.map((domain) => domain.name)?.join(", "),
],
["Cuvinte cheie despre activitate", user.ongName],
["Descriere organizație", user.ongName],
Expand Down
6 changes: 3 additions & 3 deletions client/src/pages/admin/CreateUser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Button from "@/components/Button";
import { setToken } from "@/redux/features/userSlice";
import { useAppDispatch } from "@/redux/store";
import { toast } from "react-toastify";
import SocialNetworkLinks from "@/pages/public/Register/SocialNetworkLinks";
import SocialNetworkLinks from "@/components/SocialNetworkLinks";
import {
useCreateUserMutation,
useGetDomainsQuery,
Expand All @@ -29,7 +29,7 @@ const registerSchema = object({
city: string().min(1, "Orasul este obligatoriu"),
email: string()
.min(1, "Adresa de email este obligatorie")
.email("Email Address is invalid"),
.email("Adresa de email este invalidă"),
phone: string().min(1, "Telefonul este obligatoriu"),
avatar: custom<File[]>(),
domains: array(number()),
Expand Down Expand Up @@ -104,7 +104,7 @@ const CreateUser = () => {
const onSubmitHandler: SubmitHandler<RegisterInput> = async (values) => {
const formData = new FormData();
const res = await submitRegister({ ...values, username: values.email });
if (values.avatar[0].name) {
if (values.avatar?.length && values.avatar[0]?.name) {
formData.append(`files`, values.avatar[0], values.avatar[0].name);
formData.append(`ref`, "plugin::users-permissions.user");
formData.append(`refId`, res.data.user.id);
Expand Down
Loading
Loading