If player health is 0, enemy stop attacking

I’m a beginner and want to make the enemy stop attacking when player health is 0
How do i do it?

player health script

public void TakeDamage(float damage)
{
    // Pengurangan health player apabila terkena serangan
    health -= damage;
    Debug.Log(health);
    // Apabila nyawa 0, life berkurang dan nyawa akan kembali penuh
    if (health <= 0 && life > 0)
    {
        healthUIImg[life].SetActive(false);
        life--;
        health += 10;
    }

    // Kalau Player mati sementara dia reload Scene
    if (life == 0)
    {
        health = 0;
        Debug.Log("dead");
        GetComponentInChildren<Characteranimation>().Hit1(false);
        // Memanggil metode Die pada Characteranimation
        GetComponentInChildren<Characteranimation>().Die();

        // Dead animation, Menu -> Active
        gameOverCanvas.SetActive(true);

        // Stop any movement
        //Time.timeScale = 0;
    }
}

and this is my enemy chase script

public class chase : StateMachineBehaviour
{
    NavMeshAgent agent;
    Transform player;
    public int DistanceJarak;
    public int DistanceSerang;

    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        agent = animator.GetComponent<NavMeshAgent>();
        player = GameObject.FindGameObjectWithTag("Player").transform;
    }

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        agent.SetDestination(player.position);
        float distance = Vector3.Distance(player.position, animator.transform.position);
        if (distance > DistanceJarak)
            animator.SetBool("isChasing",false);
        if (distance < 1f)
            animator.SetBool("Attack",true);
    }

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        agent.SetDestination(animator.transform.position);
    }
}

Have some script track your player health (Game Manager).
Make your enemies read that value.
Sum up your enemies attack patterns in a single function.
Then, only allow that function to be called, when player health is > 0.