teams
This commit is contained in:
1 parent
15ceb4af46
commit
a2454cbab6
6 files changed
+9
-11
No files matched your search
@@ -13,6 +13,7 @@ import { mutate } from "swr";
|
||||
import type { IUser } from "@/types/user";
|
||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||
import { setUser } from "@/features/authSlice";
|
||||
import type { FormValues } from "@/pages/teams/TeamMemberForm";
|
||||
|
||||
const TeamMemberConfig = () => {
|
||||
const [dialogOpen, setDialogOpen] = useState<boolean>(false);
|
||||
@@ -20,7 +21,7 @@ const TeamMemberConfig = () => {
|
||||
const navigate = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
const { id, memberId } = useParams();
|
||||
const { patch, loading } = usePatch();
|
||||
const { patch, loading } = usePatch<Partial<FormValues>, any>();
|
||||
const { get: getOnDemand } = useGetOnDemand<IUser>();
|
||||
const dispatch = useAppDispatch();
|
||||
const { response } = useGet<ApiResponse<any>>("/team-members");
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useGetOnDemand } from "@/hooks/UseApi";
|
||||
import type { IUser } from "@/types/user";
|
||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||
import { setUser } from "@/features/authSlice";
|
||||
import type { FormValues } from "@/pages/teams/TeamMemberForm";
|
||||
const TeamMemberCreate = () => {
|
||||
const navigate = useNavigate();
|
||||
const dispatch = useAppDispatch();
|
||||
@@ -17,7 +18,7 @@ const TeamMemberCreate = () => {
|
||||
const { response } = useGet<ApiResponse<any>>("/team-members?type=org");
|
||||
const { response: rolesResponse } =
|
||||
useGet<ApiResponse<any>>("/roles?type=team");
|
||||
const { post } = usePost<ApiResponse<any>>();
|
||||
const { post } = usePost<FormValues>();
|
||||
const teamMembers = response?.data || [];
|
||||
const roles = rolesResponse?.data || [];
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import { useForm, Controller, type SubmitHandler } from "react-hook-form";
|
||||
import { useEffect } from "react";
|
||||
import { useInitForm } from "@/hooks/forms/UseInitTeamMemberForm";
|
||||
|
||||
type FormValues = z.infer<typeof teamMemberSchema>;
|
||||
export type FormValues = z.infer<typeof teamMemberSchema>;
|
||||
|
||||
export const TeamMemberForm = ({
|
||||
mode = "create",
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
import { TeamsForm } from "@/pages/teams/TeamsForm";
|
||||
|
||||
import { useNavigate, useParams } from "react-router";
|
||||
import { z } from "zod";
|
||||
import { teamSchema } from "@/validation";
|
||||
import { useGet, usePatch, useGetOnDemand } from "@/hooks/UseApi";
|
||||
import type { ApiResponse } from "@/types/api";
|
||||
import type { IUser } from "@/types/user";
|
||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||
import { setUser } from "@/features/authSlice";
|
||||
import { mutate } from "swr";
|
||||
import type { FormValues } from "@/pages/teams/TeamsForm";
|
||||
|
||||
const TeamsConfigPage = () => {
|
||||
type FormValues = Omit<z.infer<typeof teamSchema>, "roleId">;
|
||||
const navigate = useNavigate();
|
||||
const { response } = useGet<ApiResponse<any>>("/roles?type=team");
|
||||
const { patch, loading } = usePatch<FormValues, ApiResponse<any>>();
|
||||
const { patch, loading } = usePatch<Partial<FormValues>, ApiResponse<any>>();
|
||||
const { get: getOnDemand } = useGetOnDemand<IUser>();
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
import { TeamsForm } from "@/pages/teams/TeamsForm";
|
||||
|
||||
import { useNavigate } from "react-router";
|
||||
import { z } from "zod";
|
||||
import { teamSchema } from "@/validation";
|
||||
import { useGet, usePost, useGetOnDemand } from "@/hooks/UseApi";
|
||||
import type { ApiResponse } from "@/types/api";
|
||||
import { mutate } from "swr";
|
||||
import type { IUser } from "@/types/user";
|
||||
import { useAppDispatch } from "@/hooks/AppHooks";
|
||||
import { setUser } from "@/features/authSlice";
|
||||
import type { FormValues } from "@/pages/teams/TeamsForm";
|
||||
|
||||
const TeamsCreatePage = () => {
|
||||
type FormValues = z.infer<typeof teamSchema>;
|
||||
const { response } = useGet<ApiResponse<any>>("/roles?type=team");
|
||||
const { post, loading } = usePost<FormValues>();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -14,7 +14,7 @@ import { useForm, Controller, type SubmitHandler } from "react-hook-form";
|
||||
import { useEffect } from "react";
|
||||
import { useInitForm } from "@/hooks/forms/UseInitTeamsForm";
|
||||
|
||||
type FormValues = z.infer<typeof teamSchema>;
|
||||
export type FormValues = z.infer<typeof teamSchema>;
|
||||
|
||||
export const TeamsForm = ({
|
||||
mode = "create",
|
||||
|
||||
Reference in new issue
Block a user