* refactor customer api * refactor slots api * hooks/customers: use invalidateQueries * refactor services api * optimize hooks queryKey * refactor orders api * typo refactor hooks * fix telegramId type (number) * fix bot with new api * rename customers masters & clients query * fix useClientsQuery & useMastersQuery query * new line after 'use client' & 'use server' directives
14 lines
318 B
TypeScript
14 lines
318 B
TypeScript
'use server';
|
|
|
|
import { authOptions } from '@/config/auth';
|
|
import { getServerSession } from 'next-auth/next';
|
|
|
|
export async function getSessionUser() {
|
|
const session = await getServerSession(authOptions);
|
|
const user = session?.user;
|
|
|
|
if (!user?.telegramId) throw new Error('Missing session');
|
|
|
|
return user;
|
|
}
|