From 4101043d65a3ce2729baa47521301c599e731f92 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 19 Feb 2024 19:44:56 +0800 Subject: [PATCH] :ambulance: Fix request was not imported --- pkg/view/src/components/NameCard.tsx | 1 + pkg/view/src/components/posts/PostEditActions.tsx | 1 + pkg/view/src/components/posts/PostEditor.tsx | 1 + pkg/view/src/components/posts/PostItem.tsx | 1 + pkg/view/src/components/posts/PostList.tsx | 1 + pkg/view/src/components/posts/PostPublish.tsx | 1 + pkg/view/src/pages/account.tsx | 1 + pkg/view/src/pages/auth/callback.tsx | 1 + pkg/view/src/pages/auth/callout.tsx | 1 + pkg/view/src/pages/creators/edit.tsx | 1 + pkg/view/src/pages/creators/index.tsx | 1 + pkg/view/src/pages/global.tsx | 1 + pkg/view/src/pages/post.tsx | 3 ++- pkg/view/src/pages/realms/index.tsx | 1 + pkg/view/src/pages/realms/realm.tsx | 1 + pkg/view/src/pages/search.tsx | 3 ++- pkg/view/src/scripts/request.ts | 2 +- pkg/view/src/stores/userinfo.tsx | 1 + pkg/view/src/stores/wellKnown.tsx | 1 + 19 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkg/view/src/components/NameCard.tsx b/pkg/view/src/components/NameCard.tsx index 977875c..f1e870a 100644 --- a/pkg/view/src/components/NameCard.tsx +++ b/pkg/view/src/components/NameCard.tsx @@ -2,6 +2,7 @@ import { createSignal, Show } from "solid-js"; import styles from "./NameCard.module.css"; import { getAtk } from "../stores/userinfo.tsx"; +import { request } from "../scripts/request.ts"; export default function NameCard(props: { accountId: string, onError: (messasge: string | null) => void }) { const [info, setInfo] = createSignal(null); diff --git a/pkg/view/src/components/posts/PostEditActions.tsx b/pkg/view/src/components/posts/PostEditActions.tsx index ef9e64e..bd3008c 100644 --- a/pkg/view/src/components/posts/PostEditActions.tsx +++ b/pkg/view/src/components/posts/PostEditActions.tsx @@ -1,6 +1,7 @@ import { closeModel, openModel } from "../../scripts/modals.ts"; import { createSignal, For, Match, Show, Switch } from "solid-js"; import { getAtk, useUserinfo } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; import styles from "./PostPublish.module.css"; diff --git a/pkg/view/src/components/posts/PostEditor.tsx b/pkg/view/src/components/posts/PostEditor.tsx index d430bd3..61736ca 100644 --- a/pkg/view/src/components/posts/PostEditor.tsx +++ b/pkg/view/src/components/posts/PostEditor.tsx @@ -3,6 +3,7 @@ import { createEffect, createMemo, createSignal, For, onMount, Show } from "soli import Cherry from "cherry-markdown"; import "cherry-markdown/dist/cherry-markdown.min.css"; import { getAtk } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; import PostEditActions from "./PostEditActions.tsx"; export default function PostEditor(props: { diff --git a/pkg/view/src/components/posts/PostItem.tsx b/pkg/view/src/components/posts/PostItem.tsx index 1505cd0..d485016 100644 --- a/pkg/view/src/components/posts/PostItem.tsx +++ b/pkg/view/src/components/posts/PostItem.tsx @@ -1,5 +1,6 @@ import { createSignal, For, Show } from "solid-js"; import { getAtk, useUserinfo } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; import PostAttachments from "./PostAttachments.tsx"; import * as marked from "marked"; import DOMPurify from "dompurify"; diff --git a/pkg/view/src/components/posts/PostList.tsx b/pkg/view/src/components/posts/PostList.tsx index d35f26a..f8d814c 100644 --- a/pkg/view/src/components/posts/PostList.tsx +++ b/pkg/view/src/components/posts/PostList.tsx @@ -4,6 +4,7 @@ import styles from "./PostList.module.css"; import PostItem from "./PostItem.tsx"; import LoadingAnimation from "../LoadingAnimation.tsx"; import { getAtk } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; export default function PostList(props: { noRelated?: boolean, diff --git a/pkg/view/src/components/posts/PostPublish.tsx b/pkg/view/src/components/posts/PostPublish.tsx index f48062c..43fba42 100644 --- a/pkg/view/src/components/posts/PostPublish.tsx +++ b/pkg/view/src/components/posts/PostPublish.tsx @@ -1,5 +1,6 @@ import { createEffect, createSignal, Show } from "solid-js"; import { getAtk, useUserinfo } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; import styles from "./PostPublish.module.css"; import PostEditActions from "./PostEditActions.tsx"; diff --git a/pkg/view/src/pages/account.tsx b/pkg/view/src/pages/account.tsx index 07aafe9..180ebb8 100644 --- a/pkg/view/src/pages/account.tsx +++ b/pkg/view/src/pages/account.tsx @@ -3,6 +3,7 @@ import { useParams } from "@solidjs/router"; import { useSearchParams } from "@solidjs/router"; import { createStore } from "solid-js/store"; import { closeModel, openModel } from "../scripts/modals.ts"; +import { request } from "../scripts/request.ts"; import PostList from "../components/posts/PostList.tsx"; import NameCard from "../components/NameCard.tsx"; diff --git a/pkg/view/src/pages/auth/callback.tsx b/pkg/view/src/pages/auth/callback.tsx index 26ee39e..d0c5b3d 100644 --- a/pkg/view/src/pages/auth/callback.tsx +++ b/pkg/view/src/pages/auth/callback.tsx @@ -2,6 +2,7 @@ import { createSignal, Show } from "solid-js"; import { readProfiles } from "../../stores/userinfo.tsx"; import { useNavigate } from "@solidjs/router"; import Cookie from "universal-cookie"; +import { request } from "../../scripts/request.ts"; export default function AuthCallback() { const [error, setError] = createSignal(null); diff --git a/pkg/view/src/pages/auth/callout.tsx b/pkg/view/src/pages/auth/callout.tsx index d97f240..770fac9 100644 --- a/pkg/view/src/pages/auth/callout.tsx +++ b/pkg/view/src/pages/auth/callout.tsx @@ -1,4 +1,5 @@ import { createSignal, Show } from "solid-js"; +import { request } from "../../scripts/request.ts"; export default function AuthCallout() { const [error, setError] = createSignal(null); diff --git a/pkg/view/src/pages/creators/edit.tsx b/pkg/view/src/pages/creators/edit.tsx index 26d1ac2..1907f2e 100644 --- a/pkg/view/src/pages/creators/edit.tsx +++ b/pkg/view/src/pages/creators/edit.tsx @@ -2,6 +2,7 @@ import PostEdit from "../../components/posts/PostEditor.tsx"; import { useNavigate, useParams } from "@solidjs/router"; import { createSignal, Show } from "solid-js"; import { getAtk } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; export default function PublishPost() { const navigate = useNavigate(); diff --git a/pkg/view/src/pages/creators/index.tsx b/pkg/view/src/pages/creators/index.tsx index ec39e15..19afe9a 100644 --- a/pkg/view/src/pages/creators/index.tsx +++ b/pkg/view/src/pages/creators/index.tsx @@ -2,6 +2,7 @@ import { createMemo, createSignal, For, Show } from "solid-js"; import { getAtk } from "../../stores/userinfo.tsx"; import LoadingAnimation from "../../components/LoadingAnimation.tsx"; import styles from "../../components/posts/PostList.module.css"; +import { request } from "../../scripts/request.ts"; export default function CreatorHub() { const [error, setError] = createSignal(null); diff --git a/pkg/view/src/pages/global.tsx b/pkg/view/src/pages/global.tsx index cf26de2..65d56e7 100644 --- a/pkg/view/src/pages/global.tsx +++ b/pkg/view/src/pages/global.tsx @@ -1,6 +1,7 @@ import { createEffect, createSignal, Show } from "solid-js"; import { createStore } from "solid-js/store"; import { useSearchParams } from "@solidjs/router"; +import { request } from "../scripts/request.ts"; import PostList from "../components/posts/PostList.tsx"; import PostPublish from "../components/posts/PostPublish.tsx"; diff --git a/pkg/view/src/pages/post.tsx b/pkg/view/src/pages/post.tsx index 0e2b833..f1b1b23 100644 --- a/pkg/view/src/pages/post.tsx +++ b/pkg/view/src/pages/post.tsx @@ -2,10 +2,11 @@ import { createSignal, Show } from "solid-js"; import { useNavigate, useParams, useSearchParams } from "@solidjs/router"; import { createStore } from "solid-js/store"; import { closeModel, openModel } from "../scripts/modals.ts"; +import { getAtk } from "../stores/userinfo.tsx"; +import { request } from "../scripts/request.ts"; import PostPublish from "../components/posts/PostPublish.tsx"; import PostList from "../components/posts/PostList.tsx"; import PostItem from "../components/posts/PostItem.tsx"; -import { getAtk } from "../stores/userinfo.tsx"; export default function PostPage() { const [error, setError] = createSignal(null); diff --git a/pkg/view/src/pages/realms/index.tsx b/pkg/view/src/pages/realms/index.tsx index 859ee29..f71a524 100644 --- a/pkg/view/src/pages/realms/index.tsx +++ b/pkg/view/src/pages/realms/index.tsx @@ -1,6 +1,7 @@ import { createSignal, For, Show } from "solid-js"; import { closeModel, openModel } from "../../scripts/modals.ts"; import { getAtk } from "../../stores/userinfo.tsx"; +import { request } from "../../scripts/request.ts"; export default function RealmDirectoryPage() { const [error, setError] = createSignal(null); diff --git a/pkg/view/src/pages/realms/realm.tsx b/pkg/view/src/pages/realms/realm.tsx index a338232..b655aba 100644 --- a/pkg/view/src/pages/realms/realm.tsx +++ b/pkg/view/src/pages/realms/realm.tsx @@ -1,6 +1,7 @@ import { createSignal, Show } from "solid-js"; import { createStore } from "solid-js/store"; import { useNavigate, useParams } from "@solidjs/router"; +import { request } from "../../scripts/request.ts"; import PostList from "../../components/posts/PostList.tsx"; import PostPublish from "../../components/posts/PostPublish.tsx"; diff --git a/pkg/view/src/pages/search.tsx b/pkg/view/src/pages/search.tsx index 3b42c5e..9aeea23 100644 --- a/pkg/view/src/pages/search.tsx +++ b/pkg/view/src/pages/search.tsx @@ -1,9 +1,10 @@ import { useNavigate, useSearchParams } from "@solidjs/router"; import { createSignal, Show } from "solid-js"; import { createStore } from "solid-js/store"; +import { closeModel, openModel } from "../scripts/modals.ts"; +import { request } from "../scripts/request.ts"; import PostPublish from "../components/posts/PostPublish.tsx"; import PostList from "../components/posts/PostList.tsx"; -import { closeModel, openModel } from "../scripts/modals.ts"; export default function SearchPage() { const [searchParams] = useSearchParams(); diff --git a/pkg/view/src/scripts/request.ts b/pkg/view/src/scripts/request.ts index a3f9414..b85771b 100644 --- a/pkg/view/src/scripts/request.ts +++ b/pkg/view/src/scripts/request.ts @@ -1,4 +1,4 @@ -async function request(input: string, init?: RequestInit) { +export async function request(input: string, init?: RequestInit) { const prefix = window.__LAUNCHPAD_TARGET__ ?? ""; return await fetch(prefix + input, init) } \ No newline at end of file diff --git a/pkg/view/src/stores/userinfo.tsx b/pkg/view/src/stores/userinfo.tsx index d677565..6e72ea7 100644 --- a/pkg/view/src/stores/userinfo.tsx +++ b/pkg/view/src/stores/userinfo.tsx @@ -1,6 +1,7 @@ import Cookie from "universal-cookie"; import {createContext, useContext} from "solid-js"; import {createStore} from "solid-js/store"; +import { request } from "../scripts/request.ts"; export interface Userinfo { isLoggedIn: boolean, diff --git a/pkg/view/src/stores/wellKnown.tsx b/pkg/view/src/stores/wellKnown.tsx index 9571212..42bebf3 100644 --- a/pkg/view/src/stores/wellKnown.tsx +++ b/pkg/view/src/stores/wellKnown.tsx @@ -1,5 +1,6 @@ import { createContext, useContext } from "solid-js"; import { createStore } from "solid-js/store"; +import { request } from "../scripts/request.ts"; const WellKnownContext = createContext();