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

@ -1,9 +1,6 @@
import { persistentAtom } from "@nanostores/persistent";
import { useStore } from "@nanostores/solid";
import { useNavigate } from "@solidjs/router";
import { createOAuthAPIClient, createRestAPIClient } from "masto";
import { action } from "nanostores";
import { createRenderEffect } from "solid-js";
export type Account = {
site: string;
@ -175,15 +172,3 @@ export const getOrRegisterApp = action(
return all[site];
},
);
export function useAccts() {
const accts = useStore($accounts);
const naviagte = useNavigate();
createRenderEffect(() => {
if (accts().length > 0) return;
naviagte("/accounts/sign-in");
});
return accts;
}