Merged
Conversation
Contributor
|
Looks great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 Summary
Adds front end authentication, saves session, user and profile data.
Adds login page at
/auth/loginProtects routes with specific access permissions
Displays correct Navbar depending on what role a user has
📁 What's Changed (in the front end)
1 Session, User and Profile Data and Supabase client
/src/routes/+layout.tsgets the session, user and profile data from supabase auth as well as the supabase client/src/hooks.server.tsdefinessafeGetSession()that can be used to get session and user data but not the profile data2 Route Protection
/src/hooks.server.tsdefinesauthGuard()which checks if there is a session and a user.It redirects to
/if a non logged in user accesses any pages that are not/or/resouces/[slug]/src/routes/+layout.sveltechecks if a profile has been logged in, and if so checks the role.It then displays either no Navbar (not logged in), a Navbar without the Admin Tools link (user logged in), or a Navbar with that link (admin logged in)
/src/routes/admin/+page.sveltechecks if a profile has the admin role.It then displays admin links or text saying 'You don't have permission to be here'
3 .env Changes
.envneeds to be renamed to.env.localPUBLIC_SUPABASE_URLandPUBLIC_SUPABASE_ANON_KEYneed to be added. Both can be found on the Supabase platform, I will also put them in the discord sst channelimport { [VARIABLE_NAME] } from '$env/static/public'🧪 How to Test
npm install(if new packages added)npm run dev/auth/login📋 Checklist
npm run lint)🧠 Notes for Reviewers
e.g. Check if component is accessible with keyboard/tab navigation.