Giter Club home page Giter Club logo

pern-todo-app's Introduction

pern-todo-app's People

Contributors

dependabot[bot] avatar ousectic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pern-todo-app's Issues

Implementing prompt rather than a new component for editing a todo

In between the tutorial, I wanted to give a try to editing the todo using a prompt function instead of calling the EditTodo Component. This is the implementation I could achieve so far

const editTodo = async (todoId: number) => {
        let newTodo = prompt("Enter the new todo");
        if (newTodo) {
            try {
                const editTodo = await fetch(
                    `http://localhost:5000/todos/${todoId}`,
                    {
                        method: "PUT",
                        headers: {
                            "Content-type": "application/json",
                        },
                        body: JSON.stringify({
                            description: newTodo,
                        }),
                    }
                );
                getTodos();
                window.location.href = "/";
            } catch (err: any) {
                console.error(err.message);
            }
        }
    };

I didn't change anything on the server-side, and apparently, when I edit a todo, it gets edited but moves to the last of the list. I realized this happens even if I'm making the request from postman, is this a Postgres thing? and is there any workaround to avoid this little bug?

Thanks a lot in advance

i have been trying to fellow the tutorial ,and i found this problem !

Hello guys , i really hope that i can understand or have an answer for this problem i am having right now.
actually i can console.log the whole request , but after adding this part that is coded in min 18:16 => 19:36
"const { description } = req.body;
const newTodo = await pool.query(
"INSERT INTO todo (description) VALUES($1) RETURNING *",
[description]
);
" i find a problem . i have this error message : "Cannot read properties of undefined (reading 'query')"
i ill be rally greatful if there is any explination for that !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.