If you did Rails in the early 2000s and stuff, or even now, or even Express has a middleware for it and stuff, you'll know what flash is. Sometimes I still think of flash as an animation engine and sadness comes over me.
So, now what we're going to do is we're going to create your account. So you're gonna fill out your application, if there's any validation issues, if it's not valid, then it's going to present a little pretty message up at the top. And here we're going to do account, API.account.create. We're gonna create your account with your email, your password, and your name.
Now, for Test to Talk, your name is important because that's what's gonna show up on the side to say who's talking, but it's completely optional. This is just something I decided to do. And then I'm going to set a little message that says, hey, good job, your account's created. Or, if there was an error that came back, I'm gonna set error to e.message. And what that's going to do is it's going to display an error message over the form itself using hooks. Again, reactjs.org, if, and you can find out more about hooks if you haven't used them, but it's a simplified, more functional way of doing state management for various pieces of state. And that's it, so I register. It's gonna redirect me to the slash, and because I redirected the slash for everything, it automatically checks for the layout in the page, the destination that it's going to through the router and through the layout, hey, I need to share this one because there's no session, and I need to share this one because there's no session. And the layout says, oh, by the way, I have a message, a flash message, boom, I'm gonna show that. And this is all still React. This is all still web-based. This is, yeah, we've barely even done anything with the app right now, and that's a good thing because that means we are focusing on building the interfaces, building the user interactions. It's not focusing on building servers and setting up things.
So, so far, we're at two API calls, which is pretty impressive considering the amount of code that you've seen, the amount of setup, and all the weird style that I have. We have a valid authentication logging in and register system with two API calls. Third would be forgot password, but I didn't put that in there. So up next, the user is now presented. They've logged in, and they are ready to go. So we know what layout does, and now we're gonna head over to our chat page. So our chat page is a nice stack layout, as you can see at tesla.talks-app-write.vercells.app and say a message there. There's that message ID for the messages we have right over, boop, boop, boop, boop, right there. That's the messages ID. So that's the collection ID. Again, I could have given it any name I want to, but I just used unique because I didn't feel like filling in the box.
Comments