shivansh-bhatnagar18 / multiplayer-uno

https://multiplayer-uno.vercel.app
21 stars 43 forks source link

Frontend: Import and use Auth context to verify user login state #149

Closed Spikoftw closed 1 week ago

Spikoftw commented 1 week ago

Description

Fixed the issue causing screen flicker when clicking "Create Game" without being logged in. Added an authentication check on the homepage before navigating to the game creation page. Displayed a toast with an alert message if the user is not logged in and attempts to create a game and redire t to login page.

Motivation and Context

Providing immediate feedback via a toast helps users easily understand why their action failed and redirect user to login.

How to Test

Make sure you are logged out of the application. Navigate to the homepage. Click on the "Start Game" button. Verify that the message "You need to log in to create a game" appears and that there is no screen flicker and that you are redirected to login page. Log in to the application. Click the "Start Game" button again. Verify that you are redirected to the game creation page without any issues.

Related Issues

Fixes #142

Checklist

Screenshots

https://github.com/shivansh-bhatnagar18/multiplayer-uno/assets/77557266/c475470d-e5cd-46a6-93cf-cca633534ca9

vercel[bot] commented 1 week ago

@Spikoftw is attempting to deploy a commit to the Shivansh Bhatanagar's projects Team on Vercel.

A member of the Team first needs to authorize it.

Spikoftw commented 1 week ago

Hello, thanks for the reply, is it ok now ?

Spikoftw commented 1 week ago

Sorry for this, i'm new to this. I hope this time it's the good one. lol :)

vercel[bot] commented 1 week ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
multiplayer-uno ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 26, 2024 11:38am
Spikoftw commented 1 week ago

Do i need to do something else for this issue ?

kuv2707 commented 1 week ago

Please fix the pr description to have a proper fixes #issuenumber clause.

Spikoftw commented 1 week ago

Ive made changes to the description. Is it good now ?

kuv2707 commented 1 week ago

I dont find the fixes clause in the PR description. You can refer to other (merged) PRs to know what i am referring to

And there's a review comment to be addressed. Other than that it looks fine!

Spikoftw commented 1 week ago

I'm sorry but i dont get it. i ve seens the others PRs but i still dont get what you expect from me. Maybe i'm not watching the right thing, can you show me an example ? You just want me to put the word "fixes" before #142 ? Sorry i feel stupid ahah xD

kuv2707 commented 1 week ago

Its okay, its often the little things that bug us. You got that right now. And undo the removal of <string> as i had mentioned in a comment

The changes are fit to merge otherwise

Spikoftw commented 1 week ago

Thanks! The removal of <string> ? I don't see the comment about that

Spikoftw commented 1 week ago

fixed

kuv2707 commented 1 week ago

Merged, thanks @Spikoftw