move updateRole closer to profile-card
This commit is contained in:
parent
0a49f8dc7d
commit
7652ca9bb4
@ -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,
|
||||
});
|
||||
}
|
||||
|
||||
9
apps/web/components/profile/lib/actions.ts
Normal file
9
apps/web/components/profile/lib/actions.ts
Normal file
@ -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,
|
||||
});
|
||||
}
|
||||
@ -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';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user