Get message from database through node Js api | React Socket Chat App | MERN | part 18

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends, welcome to my channel, there are 18 videos of Par and Chat series and in today's video we will get the messages and display them which we had saved in the database. Let's see in the data base. Let us assume that a list of our goals will appear. Whenever we click on a user, we have to get his messages. What to do for this is our code in the side bar where we are handling the chat room. Here we have an API. If we want to make a call then we take the access, once the access is imported, our call was done by another one of dot gut, we copy the path from the browser and we see 5000 messages, something like this, we need this path and this ID means This is the ID of the user on the basis of which we will gate it, so let's tick it once. Here this is our path and now we will have to pass the ID of one Kim user. Here we take the user dot ar ID, ok and come on. After this, we take its response in the data and console the response. Let's see the console data log response. After console it, what comes, like if I click on it, will its ID go? See, our data also came and the data in it. Look at the message, there are three messages, these three, so once what do we do, we make this message pass, so out of the messages, we had one message here, we have to pass it, set all the messages in the cyber and we pass it. Set all messages and let's take it here once and what is there right here dot give console here let's take one message of ours, you see once see response data data data data data data, all our messages will be found in this, okay And after giving the dot, there will be a dot in the catch catch. Fill the error in the console. Just console the error. Let's see once again. Will we put data on the data map or refresh the data? Then see once. See the old ones. As many of the messages came here, see which messages came from him. Is this the message written by Vikas, Karthik and Karti, Hello Vikas and Vikas wrote Hello how are you and this message was done by Vikas. Okay, so we have got our messages gated. Now we have made another A and delete key, let's see [music] , there is one in this, there is another delete message key, so what do we do to delete this message, this is your main chat, here in the chat we will find the delete button . On the delete button, we call the delete key and here we take a function on click to handle delete and send it under the item ID. We need the ID of the message for that, so we send it inside this. While selecting the box, delete it and in it there is an ID and we have come to send the same ID, there will be text and act delete in it, this is the same thing, we will copy it and it will go like this, we will just pass the ID. This will be our ID of the message and after this what do we write a response ? Give reply and reply to console. Catch error in chat and its console. We took this user and we see that the network call is fine. This is the first message. On this I delete it. See. From the way we deleted it, we saw what came back on Y, see the text in it and see its response, receiver sender message, take the same message, we got it returned, see how many messages came to us after reaching Y, see that our message has been deleted and We have received this message, this message has been deleted from our database and now what do we have to do? As soon as a user deletes a message, if another user has any message then they would accept it if that message is lying here. So it should be deleted from here also, like suppose if I delete it from here, then what is happening now, see this message with 'yes' has been deleted in the database, but the other message should also be deleted from this user, so we need to know this. If you have to do it through socket, then friends, that's all for today's video, in the next video and in the next video, we will work on this socket function and if you have not subscribed to the channel till now, then please subscribe to the channel and Don't forget to press the bell icon, like the video, share and comment, see you in the next video.
Info
Channel: KartikTheCoder
Views: 71
Rating: undefined out of 5
Keywords:
Id: 51nbzSeEvNI
Channel Id: undefined
Length: 8min 25sec (505 seconds)
Published: Thu Mar 14 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.