Remove inatjs config change

This commit is contained in:
Johannes Klein
2026-05-13 15:55:13 +02:00
parent e198556598
commit d7d4a6449d

View File

@@ -1,21 +1,15 @@
import type { ErrorWithResponse, INatApiError } from "api/error";
import handleError from "api/error";
import inatjs from "inaturalistjs";
import Config from "react-native-config";
const fetchUserPosts = async (
params: Record<string, unknown> = {},
opts: Record<string, unknown> = {},
): Promise<Record<string, unknown> | null | ErrorWithResponse | INatApiError> => {
try {
inatjs.setConfig( { apiURL: "https://api.inaturalist.org/v1" } );
const response = await inatjs.posts.for_user( params, opts );
inatjs.setConfig( { apiURL: Config.API_URL } );
if ( !response ) { return null; }
// v1 return
return response;
// v2 return
// return response?.results;
return response?.results;
} catch ( e ) {
return handleError(
e as ErrorWithResponse,