move get functions to lib
This commit is contained in:
parent
34a18cae54
commit
bbea849de9
|
@ -0,0 +1,9 @@
|
||||||
|
import prisma from "./db"
|
||||||
|
export async function getStories() {
|
||||||
|
"use server"
|
||||||
|
return prisma.story.findMany()
|
||||||
|
}
|
||||||
|
export async function getPubs() {
|
||||||
|
"use server"
|
||||||
|
return prisma.pub.findMany()
|
||||||
|
}
|
|
@ -1,10 +1,5 @@
|
||||||
import prisma from "app/lib/db"
|
import { getPubs } from "app/lib/get"
|
||||||
|
|
||||||
export default async function PubsDropdown() {
|
export default async function PubsDropdown() {
|
||||||
async function getPubs() {
|
|
||||||
"use server"
|
|
||||||
return prisma.pub.findMany()
|
|
||||||
}
|
|
||||||
const pubs = await getPubs()
|
const pubs = await getPubs()
|
||||||
const pubsDropdown = pubs.map(e => {
|
const pubsDropdown = pubs.map(e => {
|
||||||
return <option value={e.id} key={e.title}>{e.title}</option>
|
return <option value={e.id} key={e.title}>{e.title}</option>
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
import prisma from "app/lib/db"
|
import { getStories } from "app/lib/get"
|
||||||
|
|
||||||
export default async function StoryDropdown() {
|
export default async function StoryDropdown() {
|
||||||
async function getStories() {
|
|
||||||
"use server"
|
|
||||||
return prisma.story.findMany()
|
|
||||||
}
|
|
||||||
const stories = await getStories()
|
const stories = await getStories()
|
||||||
const storiesDrowpdown = stories.map(e => {
|
const storiesDrowpdown = stories.map(e => {
|
||||||
return <option value={e.id} key={`${e.title}`}>{e.title}</option>
|
return <option value={e.id} key={`${e.title}`}>{e.title}</option>
|
||||||
|
|
Loading…
Reference in New Issue