fix: collaborator detection in backend and frontend
modify: backend build script revert: clean search bar on create/edit in frontend update: API urls in frontend
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"apiConfig": {
|
||||
"baseUrl": "https://api.miarma.net/v2/huertos",
|
||||
"coreUrl": "https://api.miarma.net/v2/core",
|
||||
"baseUrl": "https://api.huertosbellavista.es/v2/huertos",
|
||||
"coreUrl": "https://api.huertosbellavista.es/v2/core",
|
||||
"endpoints": {
|
||||
"auth": {
|
||||
"login": "/auth/login",
|
||||
|
||||
@@ -146,7 +146,7 @@ const SocioCard = ({ identity, isNew = false, onCreate, onUpdate, onDelete, onCa
|
||||
if (!(createMode || editMode)) return;
|
||||
|
||||
const latestNumber = import.meta.env.MODE === 'production' ?
|
||||
await getData("https://api.miarma.net/v2/huertos/users/latest-number", {}, false)
|
||||
await getData("https://api.huertosbellavista.es/v2/huertos/users/latest-number", {}, false)
|
||||
: await getData("http://localhost:8081/v2/huertos/users/latest-number", {}, false);
|
||||
|
||||
const nuevoNumero = latestNumber + 1;
|
||||
|
||||
@@ -28,7 +28,7 @@ const NewUserForm = ({ onSubmit, userType, plotNumber, fieldErrors }) => {
|
||||
|
||||
try {
|
||||
const latestNumber = import.meta.env.MODE === 'production' ?
|
||||
await getData("https://api.miarma.net/v2/huertos/users/latest-number", {}, false)
|
||||
await getData("https://api.huertosbellavista.es/v2/huertos/users/latest-number", {}, false)
|
||||
: await getData("http://localhost:8081/v2/huertos/users/latest-number", {}, false);
|
||||
setForm((prev) => ({
|
||||
...prev,
|
||||
|
||||
@@ -79,7 +79,7 @@ export const useData = (config, onError) => {
|
||||
headers: getAuthHeaders(),
|
||||
params: current.params,
|
||||
});
|
||||
setData([...response.data]);
|
||||
setData(response.data);
|
||||
} catch (err) {
|
||||
const error = handleAxiosError(err);
|
||||
setError(error);
|
||||
|
||||
@@ -133,8 +133,6 @@ const SociosContent = ({ reqConfig }) => {
|
||||
setCreatingSocio(false);
|
||||
setTempSocio(null);
|
||||
setFieldErrors(null);
|
||||
setSearchTerm("");
|
||||
setFilters({...filters, todos: true});
|
||||
} catch (err) {
|
||||
setTempSocio({ ...newSocio });
|
||||
if (err?.status === 422 && err?.errors) {
|
||||
@@ -146,9 +144,7 @@ const SociosContent = ({ reqConfig }) => {
|
||||
const handleEditSubmit = async (updatedSocio, userId) => {
|
||||
console.log(updatedSocio);
|
||||
try {
|
||||
await putData(`${reqConfig.baseUrl}/${userId}`, updatedSocio, true);
|
||||
setSearchTerm("");
|
||||
setFilters({...filters, todos: true});
|
||||
await putData(`${reqConfig.baseUrl}/${userId}`, updatedSocio, true);
|
||||
} catch (err) {
|
||||
if (err?.status === 422 && err?.errors) {
|
||||
setFieldErrors(err.errors);
|
||||
|
||||
Reference in New Issue
Block a user