Redirect off auth required page if isn't authed
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { pushState } from '$app/navigation';
|
||||
import { goto, pushState } from '$app/navigation';
|
||||
import { resolve } from '$app/paths';
|
||||
import he from 'he';
|
||||
import type Peer from 'peerjs';
|
||||
@@ -240,3 +240,9 @@ export function logoutStores() {
|
||||
playlistCacheStore.set({});
|
||||
channelCacheStore.set({});
|
||||
}
|
||||
|
||||
export function authProtected() {
|
||||
if (!get(authStore) && !isYTBackend()) {
|
||||
goto(resolve('/', {}), { replaceState: true });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getFeed } from '$lib/api/index';
|
||||
import type { PlaylistPageVideo, Video, VideoBase } from '$lib/api/model';
|
||||
import { localDb } from '$lib/dexie';
|
||||
import { excludeDuplicateFeeds } from '$lib/misc';
|
||||
import { authProtected, excludeDuplicateFeeds } from '$lib/misc';
|
||||
import { feedCacheStore } from '$lib/store';
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { get } from 'svelte/store';
|
||||
@@ -35,6 +35,8 @@ async function sortVideosByFavourites(videos: supportedVideos): Promise<supporte
|
||||
}
|
||||
|
||||
export async function load() {
|
||||
authProtected();
|
||||
|
||||
let videos = get(feedCacheStore).subscription;
|
||||
|
||||
if (!videos) {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { getSubscriptions } from '$lib/api';
|
||||
import { authProtected } from '$lib/misc';
|
||||
import { error } from '@sveltejs/kit';
|
||||
|
||||
export async function load() {
|
||||
authProtected();
|
||||
|
||||
let subscriptions;
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user