i created a registration page and a login page for a todo app, the user should have an account before he use the account.
function TodoForm({ addTodo }) {
const [content, setContent] = useState("");
async function handleSubmit(e) {
e.preventDefault();
try {
const token = window.localStorage.getItem("token")
console.log("Token: ", token)
const response = await axios.get("https://todo-api-bvr7.onrender.com/todo/", {
headers: { "Authorization": `Bearer ${token}` }
},
{
content: content,
})
addTodo(content);
setContent("")
console.log(response)
toast.success( this users );
} catch {
console.log(e)
toast.error( failed, check your details )
}
}
i tried generating a token from the login , its expected that once the user login he should see his previous todolist , but each time its created it disappears