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