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
  • 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