Issues calling rest api from a custom plugin javascript

So, I have a custom plugin I’m working on for a WordPress site. I need to make an ajax call when a button is clicked. But when I make the call, nothing happens. So far I got this:

  1. I’ve already registered the rest route like this on the plugin php file:

    register_rest_route( $ base_path, ‘/agencias-all/’, array( ‘methods’ => ‘GET’, ‘callback’ => array( $ this, ‘get_agencias_all_sorted’ ), ));

  2. Got this code on the plugin main js file (which is already enqueued, and the function is available for me on the front end)

    function getAgenciasSorted(){ $ ("#agencias").addClass("loading"); console.log(‘test’);

    $ .get(mypath + ‘agencias-all’).done( response =>{ console.log(‘test 1’);
    console.log(response); }).complete( ()=>{ $ ("#agencias").removeClass("loading"); }) }

And I’m at lost here. The function runs, the console shows the first log "test". But doesn’t shows the second log of "test 1" nor the response. But what’s weird is that if I go to the network tabs in the dev tools, and look for the get_all call, it’s there, and it shows the response there. However, for some reason, it’s not running any code inside the .done

The rest of the api calls are run while the page loads, and those work fine. I’m just struggling to get this one in particular working. Any tips or help would be strongly appreciated, as I’m just starting to work with custom plugins.