diff --git a/apps/web/actions/profile.ts b/apps/web/actions/profile.ts index 07e9c09..49b3ba6 100644 --- a/apps/web/actions/profile.ts +++ b/apps/web/actions/profile.ts @@ -1,8 +1,7 @@ -/* eslint-disable canonical/id-match */ 'use server'; import { authOptions } from '@/config/auth'; import { getCustomer, updateCustomerProfile } from '@repo/graphql/api'; -import { type CustomerInput, Enum_Customer_Role } from '@repo/graphql/types'; +import { type CustomerInput } from '@repo/graphql/types'; import { getServerSession } from 'next-auth/next'; import { revalidatePath } from 'next/cache'; @@ -36,9 +35,3 @@ export async function updateProfile(input: CustomerInput) { revalidatePath('/profile'); } - -export async function updateRole(checked: boolean) { - return updateProfile({ - role: checked ? Enum_Customer_Role.Master : Enum_Customer_Role.Client, - }); -} diff --git a/apps/web/components/profile/lib/actions.ts b/apps/web/components/profile/lib/actions.ts new file mode 100644 index 0000000..89f289b --- /dev/null +++ b/apps/web/components/profile/lib/actions.ts @@ -0,0 +1,9 @@ +/* eslint-disable canonical/id-match */ +import { updateProfile } from '@/actions/profile'; +import { Enum_Customer_Role } from '@repo/graphql/types'; + +export function updateRole(checked: boolean) { + return updateProfile({ + role: checked ? Enum_Customer_Role.Master : Enum_Customer_Role.Client, + }); +} diff --git a/apps/web/components/profile/profile-card.tsx b/apps/web/components/profile/profile-card.tsx index 2b42fbf..02ba11b 100644 --- a/apps/web/components/profile/profile-card.tsx +++ b/apps/web/components/profile/profile-card.tsx @@ -1,5 +1,6 @@ 'use client'; -import { getProfile, updateProfile, updateRole } from '@/actions/profile'; +import { updateRole } from './lib/actions'; +import { getProfile, updateProfile } from '@/actions/profile'; import { CheckboxWithText } from '@/components/profile/checkbox-with-text'; import { ProfileField } from '@/components/profile/profile-field'; import { Avatar, AvatarFallback, AvatarImage } from '@repo/ui/components/ui/avatar';