BC-5 fix: general tab of preferences form submitting.

This commit is contained in:
a.bouhuolia
2021-09-04 18:49:01 +02:00
parent d6d6fefd1f
commit 11df54d4ed
25 changed files with 251 additions and 131 deletions

View File

@@ -27,3 +27,4 @@ export * from './landedCost';
export * from './UniversalSearch/UniversalSearch';
export * from './GenericResource';
export * from './jobs';
export * from './misc';

View File

@@ -0,0 +1,16 @@
import { useRequestQuery } from '../useQueryRequest';
/**
* Retrieve the job metadata.
*/
export function useDateFormats(props = {}) {
return useRequestQuery(
['DATE_FORMATS'],
{ method: 'get', url: `/date_formats` },
{
select: (res) => res.data.data,
defaultData: [],
...props,
},
);
}

View File

@@ -72,3 +72,22 @@ export function useOrganizationSetup() {
},
);
}
/**
* Saves the settings.
*/
export function useUpdateOrganization(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(information) => apiRequest.put('organization', information),
{
onSuccess: () => {
queryClient.invalidateQueries(t.ORGANIZATION_CURRENT);
queryClient.invalidateQueries(t.ORGANIZATIONS);
},
...props,
},
);
}