Skip to content

Commit

Permalink
modify: prismaファイルインポート
Browse files Browse the repository at this point in the history
  • Loading branch information
kensiiwasaki committed Nov 23, 2023
1 parent 2e6633c commit fe36da3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { ActionFunction, LoaderFunction } from "@remix-run/node";
import { json } from "@remix-run/node";
import { Form, Link, useActionData, useNavigation } from "@remix-run/react";
import { OpenAI } from "openai";
import { findAllTask } from "~/datasource/prisma/task";
import { NormalPrompt } from "~/util/prompt";

const prisma = new PrismaClient();
Expand All @@ -20,9 +21,7 @@ export const loader: LoaderFunction = (args) => {
return rootAuthLoader(args, async ({ request }) => {
const { userId } = request.auth;

const tasks = userId
? await prisma.task.findMany({ where: { userId } })
: [];
const tasks = userId ? await findAllTask(userId) : [];

return json({ tasks });
});
Expand Down

0 comments on commit fe36da3

Please sign in to comment.