Protecting resources with a Protected Layout and slots in Svelte / SvelteKit
Often times, we'll have pages that need to be protected and expect a user to be logged in. We covered the basics of doing this previously with the settings page, but we want to make sure we can do this anywhere without repeating too much code. We can easily do this with "slots" from Svelte and layout files from SvelteKit. In this episode I show how to do that.
š¤Æ Support
ā±ļø Timestamps:
š Newsletter:
šŖElsewhere:
šConcepts:
šResources:
š¬ Subscribe!
My name is David W Parker and Iām creating and publishing videos on ProgrammingTIL to help teach anyone and everyone who wants to code. Iām a huge fan of Ruby on Rails, Svelte, TailwindCSS, and WebGL. Iāve used React a lot in the past, as well as some Vue and AngularJS. Iāve done some professional Python and Django. I like to create real applications and my tutorials will walk you through how to build something real from beginning-to-end.
š¤Æ Support
- https://www.patreon.com/davidwparker
- https://www.buymeacoffee.com/davidwparker
ā±ļø Timestamps:
- 00:00 - Introduction
- 00:38 - Demo
- 01:15 - Nav changes
- 01:50 - About changes
- 02:10 - Settings changes
- 03:20 - Protected Layout
- 05:00 - Other ways to do this
š Newsletter:
- https://www.programmingtil.com/
šŖElsewhere:
- Twitter: https://twitter.com/davidwparker
- Twitter: https://twitter.com/programmingtil
- GitHub: https://github.com/davidwparker
šConcepts:
- Slots in Svelte
- Layouts
šResources:
- https://github.com/davidwparker/programmingtil-svelte/tree/ep18
- https://kit.svelte.dev/docs#layouts
- https://svelte.dev/docs#slot
š¬ Subscribe!
- http://bit.ly/subdavidwparker
My name is David W Parker and Iām creating and publishing videos on ProgrammingTIL to help teach anyone and everyone who wants to code. Iām a huge fan of Ruby on Rails, Svelte, TailwindCSS, and WebGL. Iāve used React a lot in the past, as well as some Vue and AngularJS. Iāve done some professional Python and Django. I like to create real applications and my tutorials will walk you through how to build something real from beginning-to-end.
svelte #sveltekit
Ā© programmingtil.com