mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-27 09:05:01 +00:00
Refactor person creation workflow: Introduce PersonEdit
component and integrate it across Create
, Person.vue
, and modals for improved modularity. Update type definitions and API methods for consistency.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { fetchResults, makeFetch } from "ChillMainAssets/lib/api/apiMethods";
|
||||
import { Center, Civility, Gender } from "ChillMainAssets/types";
|
||||
import { AltName, Person } from "ChillPersonAssets/types";
|
||||
|
||||
/*
|
||||
* GET a person by id
|
||||
*/
|
||||
export const getPerson = async (id: number): Promise<Person> => {
|
||||
const url = `/api/1.0/person/person/${id}.json`;
|
||||
return fetch(url).then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw Error("Error with request resource response");
|
||||
});
|
||||
};
|
||||
|
||||
export const getPersonAltNames = async (): Promise<AltName[]> =>
|
||||
fetch("/api/1.0/person/config/alt_names.json").then((response) => {
|
||||
if (response.ok) {
|
||||
return response.json();
|
||||
}
|
||||
throw Error("Error with request resource response");
|
||||
});
|
||||
|
||||
export const getCivilities = async (): Promise<Civility[]> =>
|
||||
fetchResults("/api/1.0/main/civility.json");
|
||||
|
||||
export const getGenders = async (): Promise<Gender[]> =>
|
||||
fetchResults("/api/1.0/main/gender.json");
|
||||
|
||||
export const getCentersForPersonCreation = async (): Promise<Center[]> =>
|
||||
makeFetch("GET", "/api/1.0/person/creation/authorized-centers", null);
|
Reference in New Issue
Block a user