if I call:

const success = handleApiResponseWithState(
	response,
	setErrorMessage,
	setSuccessMessage,
	setFormValidationErrors,
	setUserId,
	setUserToken,
	setStep
);

if (success && response.message)
{

}

export function handleApiResponseWithState<Type = any>(
	response: GenericResponse<Type>,
	setErrorMessage: Dispatch<SetStateAction<string | null>>,
	setSuccessMessage: Dispatch<SetStateAction<string | null>>,
	setFormValidationErrors: Dispatch<SetStateAction<ApiErrorDetail>>,
	setUserId: Dispatch<SetStateAction<number | null>>,
	setUserToken: Dispatch<SetStateAction<string | null>>,
	setStep: Dispatch<SetStateAction<number>>,
	// "nextStepMap" - Used as map for setting steps calls from backend data array next_step
	nextStepMap: Record<string, number> =
	{
		email_verification: 1,
		password_setup: 2,
		business_category: 3,
		// add other mappings if needed
	}
): boolean
{
	/**
	* Call HandleApiResponseWithState();
	*
	* 	HandleApiResponseWithState(
	*		response,
	*		setErrorMessage,
	*		setSuccessMessage,
	*		setFormValidationErrors,
	*		emitGlobalAlert: bool
	*	);
	*/
	const success = handleApiResponse(
		response,
		setErrorMessage,
		setSuccessMessage,
		setFormValidationErrors,
		false// using default true for emitGlobalAlert parameter, so omit here for brevity
	);
	
	if (success && response.data)
	{
		// Confirm passing setStep to handleApiResponseWithState
		if (typeof setStep === 'function')
		{
			if (typeof response.data.userId === 'number')
			{
				setUserId(response.data.userId);
			}
			if (typeof response.data.signup_phase === 'number')
			{
				setStep(response.data.signup_phase);
			}
			else if (
				typeof response.data.next_step === 'string' &&
				nextStepMap[response.data.next_step] !== undefined
			)
			{
				setStep(nextStepMap[response.data.next_step]);
			}
			else
			{
				setStep(0);
			}
		}
		
		if (
			'token' in response.data &&
			typeof response.data.token === 'string'
		)
		{
			setUserToken(response.data.token);
			localStorage.setItem('jwtToken', response.data.token);
		}
	}
		
	return success;
}

that than uses:

export function handleApiResponse<Type = any>
(
	response: GenericResponse<Type>,
	setErrorMessage: Dispatch<SetStateAction<string | null>>,
	setSuccessMessage: Dispatch<SetStateAction<string | null>>,
	setFormValidationErrors: Dispatch<SetStateAction<ApiErrorDetail>>,
	emitGlobalAlert: boolean = true// default param to allow skipping alert if needed
): boolean
{
	if (response.success)
	{
		setErrorMessage(null);
		setSuccessMessage(response.message || null);
		setFormValidationErrors({});
		
		if (emitGlobalAlert && response.message)
		{
			emitEvent('alert', { type: 'success', message: response.message });
		}
		
		return true;
	}
	else
	{
		const errorMsg = response.message || 'An unknown error occurred.';
		
		setErrorMessage(errorMsg);
		
		if (response.errors && typeof response.errors === 'object')
		{
			setFormValidationErrors(response.errors);
		}
		else
		{
			setFormValidationErrors({});
		}
		
		if (emitGlobalAlert)
		{
			emitEvent('alert', { type: 'danger', message: errorMsg });
		}
		
		// Log error for diagnostics
		logger.error('Handle Api Response Error:', errorMsg);
		
		return false;
	}
}

should I be expecting a response.message? Or did I fuck myself over?