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 { Link, useLoaderData } from "@remix-run/react";
|
||||||
import { prisma } from "~/db.server";
|
import { prisma } from "~/db.server";
|
||||||
import { Form } from "@remix-run/react";
|
import { Form } from "@remix-run/react";
|
||||||
|
import { json } from "@remix-run/node";
|
||||||
|
|
||||||
const countys = [
|
const countys = [
|
||||||
"Ahvenanmaa",
|
"Ahvenanmaa",
|
||||||
|
@ -62,7 +63,7 @@ export async function action({ request }) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return countySubmit
|
return countySubmit
|
||||||
? countySubmit
|
? json(countySubmit)
|
||||||
: new Error("Something went wrong with creating the user");
|
: 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"));
|
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"));
|
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() {
|
export default function Index() {
|
||||||
|
|
Loading…
Reference in New Issue