pending ui, removed unneccessary code, cookie secret fuckery

This commit is contained in:
Joonas 2023-01-19 17:05:48 +02:00
parent 3a38a7c4ef
commit d46a516b79
4 changed files with 6 additions and 15 deletions

View File

@ -4,14 +4,6 @@ import { Link } from "@remix-run/react";
import { getSession } from "~/sessions";
import { commitSession } from "~/sessions";
export async function action({ request }) {
const formData = await request.formData();
const county = formData.get("county");
if (typeof county !== "string" || !county || !countys.includes(county))
throw new Error("bad county");
}
export async function loader({ request }) {
const session = await getSession(request.headers.get("Cookie"));
if (session.has("userId")) {

View File

@ -1,6 +1,6 @@
import { getSession } from "~/sessions";
import { getMe } from "~/utils";
import { Link, useLoaderData } from "@remix-run/react";
import { Link, useLoaderData, useTransition } from "@remix-run/react";
import { prisma } from "~/db.server";
import { Form } from "@remix-run/react";
import { json } from "@remix-run/node";
@ -110,6 +110,7 @@ export async function loader({ request }) {
export default function Index() {
const data = useLoaderData();
const transition = useTransition();
return (
<div className="flex min-h-screen flex-col">
@ -131,7 +132,7 @@ export default function Index() {
className="text-sky-400 hover:text-sky-600 hover:underline"
to={"/update"}
>
Update stats
Update
</Link>
<Link
className="text-sky-400 hover:text-sky-600 hover:underline"
@ -142,7 +143,7 @@ export default function Index() {
</div>
) : (
<a
href="https://osu.ppy.sh/oauth/authorize?client_id=20031&redirect_uri=http://localhost:3000/auth&response_type=code"
href="https://osu.ppy.sh/oauth/authorize?client_id=20062&redirect_uri=http://localhost:3000/auth&response_type=code"
referrerPolicy="no-referrer"
className="rounded-full border border-ctp-surface0 bg-ctp-surface0 px-4 py-2 shadow-md
shadow-ctp-overlay0 hover:bg-ctp-surface1 hover:shadow-ctp-overlay2"
@ -187,7 +188,7 @@ export default function Index() {
className="rounded-full border px-4 py-2 shadow shadow-ctp-overlay0 hover:shadow-xl"
type="submit"
>
Submit
{transition.state === "submitting" ? "Submitting..." : "Submit"}
</button>
</Form>
)

View File

@ -29,8 +29,6 @@ export async function loader({ request }) {
},
});
console.log(updateUser);
if (!updateUser) throw new Error("failed to update");
return redirect("/");

View File

@ -4,7 +4,7 @@ const { getSession, commitSession, destroySession } =
createCookieSessionStorage({
cookie: {
maxAge: 86400,
secrets: [process.env.COOKIE_SECRET],
secrets: ["klgkmiokmwegki034", "kf09349kfg3dsadsa"],
path: "/",
secure: true,
httpOnly: true,