-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Refactor/#150/project rewrite
- Loading branch information
Showing
27 changed files
with
662 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { putProjectPayload } from "api-models" | ||
import { AxiosRequestConfig } from "axios" | ||
import { Project, putProjectPayload } from "api-models" | ||
|
||
import { ENDPOINTS } from "@constants/endPoints" | ||
|
||
import { authInstance } from "../axiosInstance" | ||
|
||
export const putProject = async ( | ||
{ projectId, ...body }: putProjectPayload, | ||
config: AxiosRequestConfig = {}, | ||
) => { | ||
await authInstance.put(ENDPOINTS.PUT_PROJECT(projectId), body, { ...config }) | ||
projectId: number, | ||
body: putProjectPayload, | ||
): Promise<Project> => { | ||
const { data } = await authInstance.put( | ||
ENDPOINTS.PUT_PROJECT(projectId), | ||
body, | ||
) | ||
return data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/pages/ProjectEditPage/components/DefaultValueFetcher.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { useSearchParams } from "react-router-dom" | ||
|
||
import { Spinner } from "@chakra-ui/react" | ||
|
||
import { useGetProjectEdit } from "../hooks/useGetProject" | ||
import ProjectFormProvider from "../stores/ProjectFormProvider" | ||
import ProjectForm from "./ProjectForm" | ||
|
||
const DefaultValueFetcher = () => { | ||
const [searchParams] = useSearchParams() | ||
const projectId = searchParams.get("projectId") | ||
|
||
const { data: projectDetailInfo, isLoading } = useGetProjectEdit( | ||
Number(projectId), | ||
) | ||
|
||
if (isLoading) { | ||
return <Spinner /> | ||
} | ||
|
||
return ( | ||
<ProjectFormProvider | ||
defaultValues={projectDetailInfo} | ||
projectId={Number(projectId)}> | ||
<ProjectForm /> | ||
</ProjectFormProvider> | ||
) | ||
} | ||
|
||
export default DefaultValueFetcher |
164 changes: 94 additions & 70 deletions
164
src/pages/ProjectEditPage/components/Editors/Description.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.