base con autenticacion, registro, modulo encuestas
This commit is contained in:
36
apps/web/feactures/location/actions/actions.ts
Normal file
36
apps/web/feactures/location/actions/actions.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
'use server';
|
||||
import { safeFetchApi } from '@/lib/fetch.api';
|
||||
import {responseStates, responseMunicipalities, responseParishes} from '../schemas/users';
|
||||
|
||||
// import { auth } from '@/lib/auth';
|
||||
|
||||
|
||||
export const getStateAction = async () => {
|
||||
const [error, response] = await safeFetchApi(
|
||||
responseStates,
|
||||
`/location/state/`,
|
||||
'GET'
|
||||
);
|
||||
if (error) throw new Error(error.message);
|
||||
return response;
|
||||
};
|
||||
|
||||
export const getMunicipalityAction = async (id : number) => {
|
||||
const [error, response] = await safeFetchApi(
|
||||
responseMunicipalities,
|
||||
`/location/municipality/${id}`,
|
||||
'GET'
|
||||
);
|
||||
if (error) throw new Error(error.message);
|
||||
return response;
|
||||
};
|
||||
|
||||
export const getParishAction = async (id : number) => {
|
||||
const [error, response] = await safeFetchApi(
|
||||
responseParishes,
|
||||
`/location/parish/${id}`,
|
||||
'GET'
|
||||
);
|
||||
if (error) throw new Error(error.message);
|
||||
return response;
|
||||
};
|
||||
Reference in New Issue
Block a user