-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e9fb005
commit 488f8c8
Showing
6 changed files
with
82 additions
and
20 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
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,2 +1,32 @@ | ||
import { ContextModalProps } from "@mantine/modals"; | ||
import useCreateTask from "../../hooks/useCreateTask"; | ||
import React from "react"; | ||
import { useForm, zodResolver } from "@mantine/form"; | ||
import { z } from "zod"; | ||
|
||
const initialValues = { | ||
taskTitle: "", | ||
taskDescription: "", | ||
taskStatus: "", | ||
taskLabel: "", | ||
}; | ||
|
||
const schema = z.object({ | ||
taskTitle: z.string().min(1), | ||
taskDescription: z.string(), | ||
taskStatus: z.string(), | ||
taskLabel: z.string(), | ||
}); | ||
|
||
const CreateTaskModal = ({ context, id }: ContextModalProps) => { | ||
const { mutate, isLoading, isSuccess, isError, error } = useCreateTask(); | ||
|
||
const form = useForm({ | ||
schema: zodResolver(schema), | ||
initialValues, | ||
}); | ||
|
||
return <div></div>; | ||
}; | ||
|
||
export default CreateTaskModal; |
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,4 +1,15 @@ | ||
interface CreateTaskArgs { | ||
name: string; | ||
description: string; | ||
} | ||
import { useMutation } from "react-query"; | ||
import { apiInstance } from "../api/config"; | ||
import { CreateTaskRequest, Task } from "../api/dto"; | ||
|
||
const createTask = (data: CreateTaskRequest) => { | ||
return apiInstance | ||
.post("/task", data) | ||
.then((res) => res.data) as Promise<Task>; | ||
}; | ||
|
||
const useCreateTask = () => { | ||
return useMutation((formData: CreateTaskRequest) => createTask(formData)); | ||
}; | ||
|
||
export default useCreateTask; |
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