Skip to content

Commit

Permalink
Remove obsolete logging output
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianoertel committed Aug 22, 2024
1 parent ccb6852 commit f685446
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/composables/queries/useAdministrationDistrictsQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,26 @@ import { fetchDocsById } from '@/helpers/query/utils';
import { FIRESTORE_COLLECTIONS } from '@/constants/firebase';
import { ADMINISTRATION_DISTRICTS_QUERY_KEY } from '@/constants/queryKeys';

/**
* Administration Districts query.
*
* Query designed to fetch the districts assigned to an administration.
*
* @param {String} administrationId – The ID of the administration to fetch DSGF orgs for.
* @param {QueryOptions|undefined} queryOptions – Optional TanStack query options.
* @returns {UseQueryResult} The TanStack query result.
*/
const useAdministrationDistrictsQuery = (administrationId, queryOptions) => {
return useQuery({
queryKey: [ADMINISTRATION_DISTRICTS_QUERY_KEY, administrationId],
queryFn: async () => {
if (!administrationId) {
console.log('[debug] No administration ID provided.');
return [];
}
if (!administrationId) return [];

// Fetch the administration data.
const { data: administrationData } = useAdministrationQuery(administrationId);

// If not administrations were found, abort as there is no data to fetch.
if (!administrationData) {
console.log('[debug] No administrationData available.');
return [];
}
if (!administrationData) return [];

// Build the query to fetch the districts.
// @TODO: This is currently required as fetchDocsById does not actually support fetching by IDs, but rather by
Expand All @@ -36,10 +39,7 @@ const useAdministrationDistrictsQuery = (administrationId, queryOptions) => {
});

// If there are no districts to fetch, abort as there is no data to fetch.
if (!districtDocuments.length) {
console.log('[debug] No district documents');
return [];
}
if (!districtDocuments.length) return [];

return fetchDocsById(districtDocuments);
},
Expand Down

0 comments on commit f685446

Please sign in to comment.