diff --git a/.eslintrc b/.eslintrc
index a2ceebe..ccceb53 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,3 +1,7 @@
{
- "extends": ["next/babel", "next/core-web-vitals"]
-}
+ "extends": ["next", "next/core-web-vitals"],
+ "rules": {
+ // Other rules
+ "@next/next/no-img-element": "off"
+ }
+}
diff --git a/components/AddTask.js b/components/AddTask.js
index 9652adb..9841bff 100644
--- a/components/AddTask.js
+++ b/components/AddTask.js
@@ -1,10 +1,32 @@
+import axios from "axios"
+import { useState } from "react"
+import { useAuth } from "../context/auth"
+
export default function AddTask() {
+ const [task, setTask] = useState("")
+ const { token } = useAuth()
const addTask = () => {
- /**
- * @todo Complete this function.
- * @todo 1. Send the request to add the task to the backend server.
- * @todo 2. Add the task in the dom.
- */
+ axios({
+ url : 'https://todo-app-csoc.herokuapp.com/todo/create/',
+ method : "post",
+ headers: {
+ Authorization: 'Token ' + token,
+ },
+ data : {
+ title: task
+ }
+ }
+
+ )
+ .then(function ({ data, status }) {
+ setTask("");
+
+
+ })
+ .catch(function (err) {
+ })
+
+
}
return (
@@ -12,6 +34,8 @@ export default function AddTask() {
type='text'
className='todo-add-task-input px-4 py-2 placeholder-blueGray-300 text-blueGray-600 bg-white rounded text-sm border border-blueGray-300 outline-none focus:outline-none focus:ring w-full'
placeholder='Enter Task'
+ value={task}
+ onChange = {(e)=> {setTask(e.target.value)}}
/>