first prototype of StackedRouter
This commit is contained in:
parent
607fa64c05
commit
0710aaf4f3
21 changed files with 442 additions and 109 deletions
src/masto
|
@ -8,7 +8,8 @@ import {
|
|||
} from "solid-js";
|
||||
import { Account } from "../accounts/stores";
|
||||
import { createRestAPIClient, mastodon } from "masto";
|
||||
import { useLocation, useNavigate } from "@solidjs/router";
|
||||
import { useLocation } from "@solidjs/router";
|
||||
import { useNavigator } from "../platform/StackedRouter";
|
||||
|
||||
const restfulCache: Record<string, mastodon.rest.Client> = {};
|
||||
|
||||
|
@ -56,12 +57,12 @@ export const Provider = Context.Provider;
|
|||
|
||||
export function useSessions() {
|
||||
const sessions = useSessionsRaw();
|
||||
const navigate = useNavigate();
|
||||
const {push} = useNavigator();
|
||||
const location = useLocation();
|
||||
|
||||
createRenderEffect(() => {
|
||||
if (sessions().length > 0) return;
|
||||
navigate(
|
||||
push(
|
||||
"/accounts/sign-in?back=" + encodeURIComponent(location.pathname),
|
||||
{ replace: true },
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue