refactored orm operations in components to server actions
All checks were successful
Vercel Preview Deployment / Deploy-Preview (push) Successful in 1m13s
All checks were successful
Vercel Preview Deployment / Deploy-Preview (push) Successful in 1m13s
This commit is contained in:
parent
54454aad6d
commit
4b554cdb37
@ -1,9 +1,9 @@
|
||||
import { Delete } from "lucide-react";
|
||||
import { deleteCountry } from "~/server/actions/deleteCountry";
|
||||
import { db } from "~/server/db";
|
||||
import getAllCountries from "~/server/actions/getAllCountries";
|
||||
|
||||
export default async function AllCountries() {
|
||||
const countries = await db.query.countries.findMany();
|
||||
const countries = await getAllCountries();
|
||||
return (
|
||||
<div className="pt-4">
|
||||
<h1 className="text-2xl">All Countries:</h1>
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { db } from "~/server/db";
|
||||
import getAllCountries from "~/server/actions/getAllCountries";
|
||||
import getAllRegions from "~/server/actions/getAllRegions";
|
||||
|
||||
export default async function AllRegions() {
|
||||
const allRegions = await db.query.regions.findMany();
|
||||
const allCountries = await db.query.countries.findMany();
|
||||
const allRegions = await getAllRegions();
|
||||
const allCountries = await getAllCountries();
|
||||
return (
|
||||
<div className="pt-4">
|
||||
<h1 className="text-2xl">All Regions:</h1>
|
||||
|
6
src/server/actions/getAllCountries.ts
Normal file
6
src/server/actions/getAllCountries.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { db } from "../db";
|
||||
|
||||
export default async function getAllCountries() {
|
||||
const allCountries = await db.query.countries.findMany();
|
||||
return allCountries;
|
||||
}
|
6
src/server/actions/getAllRegions.ts
Normal file
6
src/server/actions/getAllRegions.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { db } from "../db";
|
||||
|
||||
export default async function getAllRegions() {
|
||||
const allRegions = await db.query.regions.findMany();
|
||||
return allRegions;
|
||||
}
|
Loading…
Reference in New Issue
Block a user