This repository has been archived on 2026-01-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nextjs-serve-actions/app/components/Settings/Profiles/actions/ProfilesAction.ts
2024-05-23 16:55:29 +02:00

24 lines
481 B
TypeScript

'use server';
import { initializeUser } from '../../../../../data/initializeUser';
import prisma from '../../../../../prisma/prisma';
export async function ProfilesAction() {
const user = await initializeUser();
try {
const profiles = await prisma.profile.findMany({
where: {
userId: user.id
},
orderBy: {
createdAt: 'desc'
}
});
return profiles;
} catch (error) {
throw new Error('Failed to find profiles');
}
}