return json properly
This commit is contained in:
parent
51efe04caa
commit
50e2ec9cb3
|
@ -3,6 +3,7 @@ import { getMe } from "~/utils";
|
|||
import { Link, useLoaderData } from "@remix-run/react";
|
||||
import { prisma } from "~/db.server";
|
||||
import { Form } from "@remix-run/react";
|
||||
import { json } from "@remix-run/node";
|
||||
|
||||
const countys = [
|
||||
"Ahvenanmaa",
|
||||
|
@ -62,7 +63,7 @@ export async function action({ request }) {
|
|||
});
|
||||
|
||||
return countySubmit
|
||||
? countySubmit
|
||||
? json(countySubmit)
|
||||
: new Error("Something went wrong with creating the user");
|
||||
}
|
||||
|
||||
|
@ -77,7 +78,7 @@ export async function loader({ request }) {
|
|||
},
|
||||
});
|
||||
const session = await getSession(request.headers.get("Cookie"));
|
||||
if (!session.has("userId")) return { countyData };
|
||||
if (!session.has("userId")) return json({ countyData });
|
||||
|
||||
const me = await getMe(session.get("userId"));
|
||||
|
||||
|
@ -87,7 +88,7 @@ export async function loader({ request }) {
|
|||
},
|
||||
});
|
||||
|
||||
return { me, countyData, selfData };
|
||||
return json({ me, countyData, selfData });
|
||||
}
|
||||
|
||||
export default function Index() {
|
||||
|
|
Loading…
Reference in a new issue