24 lines
No EOL
713 B
TypeScript
24 lines
No EOL
713 B
TypeScript
'use server'
|
|
|
|
import { Methods } from '@/shared/services/api/enums/ApiMethodEnum';
|
|
import API from '@/shared/services/api/Api';
|
|
import { withClientErrorHandler } from '@/withClientErrorHandler/withClientErrorHandler';
|
|
import { UserInterface } from '../../interfaces/User/UserInterface';
|
|
|
|
async function executeUserSaveData(data: UserInterface) {
|
|
|
|
const api = new API();
|
|
|
|
const response = await api.send({
|
|
'method': data.user_id ? Methods.PUT : Methods.POST,
|
|
'endpoint': `administrativo/user/${data.user_id ? data.user_id : ''}`,
|
|
'body': data
|
|
});
|
|
|
|
console.log(response.detail)
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
export const UserSaveData = withClientErrorHandler(executeUserSaveData) |