rewrite client providing & fix sign in redirect

This commit is contained in:
thislight 2024-07-15 13:59:10 +08:00
parent 942b9dcce8
commit 0caa9aab88
5 changed files with 106 additions and 53 deletions

View file

@ -3,15 +3,12 @@ import {
For,
onCleanup,
createSignal,
createEffect,
Show,
untrack,
onMount,
} from "solid-js";
import { $accounts, useAccts } from "../accounts/stores";
import { useDocumentTitle } from "../utils";
import { useStore } from "@nanostores/solid";
import { useMastoClientFor } from "../masto/clients";
import { useSessions } from "../masto/clients";
import { type mastodon } from "masto";
import Scaffold from "../material/Scaffold";
import {
@ -24,7 +21,6 @@ import {
MenuItem,
Switch,
Toolbar,
Typography,
} from "@suid/material";
import { css } from "solid-styled";
import { TimeSourceProvider, createTimeSource } from "../platform/timesrc";
@ -152,11 +148,11 @@ const TimelinePanel: Component<{
const Home: Component = () => {
let panelList: HTMLDivElement;
useDocumentTitle("Timelines");
const accounts = useAccts();
const now = createTimeSource();
const client = useMastoClientFor(() => accounts()[0]);
const [profile] = useAcctProfile(() => accounts()[0]);
const sessions = useSessions();
const client = () => sessions()[0].client;
const [profile] = useAcctProfile(client);
const [panelOffset, setPanelOffset] = createSignal(0);
const [prefetching, setPrefetching] = createSignal(true);