import React, { useState } from 'react' import Head from 'next/head' import Sleep from '../components/sleep' import Todos from '../components/todoStuff/todos' import constants from '../constants.json' import styles from './todos.module.css' export default function contribute() { const [newTask, setNewTask] = useState('') const submitNewTask = async () => { if (!newTask) { return } fetch(constants.apiUrl + 'postfeedback', { method: 'POST', credentials: 'include', headers: { Accept: 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ newTask: newTask, from: 'contribute', }), }) .then((resp) => { return resp.json() }) .then((resp) => { if (resp.success) { alert('Elküldve') setNewTask('') } else { alert('Hiba küldés közben') } }) .catch((err) => { alert('Hiba küldés közben') console.error(err) }) } const renderNewTaskArea = () => { return (