mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 19:02:28 +00:00
Adjust default view selection for auth state
This commit is contained in:
1 parent
26fd31e212
commit
f70217003d
2 files changed
+9
-4
No files matched your search
@@ -775,9 +775,12 @@ class Application {
|
||||
devLogger.log(
|
||||
"[app.init()] No #view= in the URL, loading default home view"
|
||||
);
|
||||
const defaultView = this.isUserLoggedIn()
|
||||
? "views/for-you.html"
|
||||
: "views/most-recent-videos.html";
|
||||
if (typeof this.loadView === "function") {
|
||||
await Promise.all([
|
||||
this.loadView("views/most-recent-videos.html"),
|
||||
this.loadView(defaultView),
|
||||
watchHistoryInitPromise,
|
||||
]);
|
||||
} else {
|
||||
|
||||
+5
-3
@@ -1392,9 +1392,11 @@ async function handleHashChange() {
|
||||
|
||||
try {
|
||||
if (!match || !match[1]) {
|
||||
// No valid "#view=..." => default to "most-recent-videos"
|
||||
await loadView("views/most-recent-videos.html");
|
||||
const initFn = viewInitRegistry["most-recent-videos"];
|
||||
// No valid "#view=..." => default to "for-you" when logged in
|
||||
const isLoggedIn = getApplication()?.isUserLoggedIn();
|
||||
const defaultViewName = isLoggedIn ? "for-you" : "most-recent-videos";
|
||||
await loadView(`views/${defaultViewName}.html`);
|
||||
const initFn = viewInitRegistry[defaultViewName];
|
||||
if (typeof initFn === "function") {
|
||||
await initFn();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user