Compare commits

..

No commits in common. "e882a8c0e80168ad301aa4d515b17c2b33ef84d9" and "149aa56cb82ea04340368623e7ead3f575994ad2" have entirely different histories.

3 changed files with 4 additions and 20 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;
@ -28,7 +25,7 @@ interface OAuth2AccessToken {
async function oauth2TokenViaAuthCode(app: RegisteredApp, authCode: string) {
const resp = await fetch(new URL("./oauth/token", app.site), {
method: "post",
method: 'post',
body: JSON.stringify({
grant_type: "authorization_code",
code: authCode,
@ -100,7 +97,7 @@ export const $registeredApps = persistentAtom<{
async function getAppAccessToken(app: RegisteredApp) {
const resp = await fetch(new URL("./oauth/token", app.site), {
method: "post",
method: 'post',
headers: {
"Content-Type": "application/json",
},
@ -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;
}

View file

@ -8,7 +8,7 @@ import {
untrack,
onMount,
} from "solid-js";
import { $accounts, useAccts } from "../accounts/stores";
import { $accounts } from "../accounts/stores";
import { useDocumentTitle } from "../utils";
import { useStore } from "@nanostores/solid";
import { useMastoClientFor } from "../masto/clients";
@ -152,7 +152,7 @@ const TimelinePanel: Component<{
const Home: Component = () => {
let panelList: HTMLDivElement;
useDocumentTitle("Timelines");
const accounts = useAccts();
const accounts = useStore($accounts);
const now = createTimeSource();
const client = useMastoClientFor(() => accounts()[0]);

View file

@ -23,6 +23,5 @@ export default defineConfig(({ mode }) => ({
},
build: {
target: ["firefox98", "safari15.4", "ios15.4", "chrome84", "edge87"],
sourcemap: true,
},
}));