Chore: Update packages

This commit is contained in:
Aron Malcher 2024-02-12 20:20:57 +01:00
parent c4251d9f51
commit 18c6535d1c
Signed by: aronmal
GPG key ID: 816B7707426FC612
5 changed files with 1055 additions and 1024 deletions

View file

@ -1,5 +1,4 @@
import { createHandler } from "@solidjs/start/entry";
import { StartServer } from "@solidjs/start/server";
import { StartServer, createHandler } from "@solidjs/start/server";
export default createHandler(() => (
<StartServer

View file

@ -37,7 +37,6 @@ const initialValue = (params: ReturnType<typeof useParams>) => ({
const getPayload = async (
id: string,
pathName: string,
): Promise<
| { success: false; message: string }
| (ReturnType<typeof initialValue> & { success: true })
@ -47,6 +46,7 @@ const getPayload = async (
const event = getRequestEvent();
if (!event) return { success: false, message: "No request event!" };
const pathname = new URL(event.request.url).pathname;
const session = await getSession(event.request, authOptions);
if (!session?.user?.id)
return { success: false, message: "No user with id!" };
@ -77,7 +77,7 @@ const getPayload = async (
headers: { Authorization: `Bot ${import.meta.env.VITE_DISCORD_BOT_TOKEN}` },
});
if (guildsRequest.error || channelsRequest.error) {
console.log(guildsRequest.error, channelsRequest.error, event.path);
console.log(guildsRequest.error, channelsRequest.error, pathname);
return {
success: false,
message: "Error on one of the discord api requests!",
@ -107,11 +107,7 @@ const getPayload = async (
});
});
console.log(
pathName,
pathName == event.path ? "server" : "client",
"success",
);
console.log(new URL(event.request.url).pathname, "success");
return {
success: true,
@ -143,9 +139,7 @@ function config() {
const [payload] = createResource(
params.guildId,
async (id) => {
const payload = await getPayload(id, location.pathname).catch((e) =>
console.warn(e, id),
);
const payload = await getPayload(id).catch((e) => console.warn(e, id));
if (!payload) {
console.error(location.pathname, payload);

View file

@ -26,9 +26,7 @@ const initialValue = () => ({
}[],
});
const getPayload = async (
pathName: string,
): Promise<
const getPayload = async (): Promise<
| { success: false; message: string }
| (ReturnType<typeof initialValue> & { success: true })
> => {
@ -37,6 +35,7 @@ const getPayload = async (
const event = getRequestEvent();
if (!event) return { success: false, message: "No request event!" };
const pathname = new URL(event.request.url).pathname;
const session = await getSession(event.request, authOptions);
if (!session?.user?.id)
return { success: false, message: "No user with id!" };
@ -63,11 +62,7 @@ const getPayload = async (
console.log(error);
return { success: false, message: "Error on discord api request!" };
}
console.log(
pathName,
pathName == event.path ? "server" : "client",
"success",
);
console.log(pathname, "success");
return {
success: true,
@ -85,9 +80,7 @@ function index() {
const [payload] = createResource(
// eslint-disable-next-line solid/reactivity
async () => {
const payload = await getPayload(location.pathname).catch((e) =>
console.warn(e),
);
const payload = await getPayload().catch((e) => console.warn(e));
if (!payload) {
console.error(location.pathname, payload);