Sorting the distances of stores from user on getCurrentPosition() mapbox

Im working with the MapBox API and I want to customize the ‘UserLocate’ button such that it not only gives the current location but also sorts locations from the user. Here’s the current code of user locate.

navigator.geolocation.getCurrentPosition(position => { 
          user_lat = position.coords.latitude;
          user_long = position.coords.longitude;
      }); 

Currently I am only able to sort distance when I use the search box in MapBox. I am changing the longitude and latitude of the searched location of event object to current user’s longitude and latitude. From there I just use the methods availible on the doc

geocoder.on('result', (event) => {
          /* Get the coordinate of the search result */
          const searchResult = event.result.geometry;
          userLoc = searchResult;
          userLoc["coordinates"][0] = user_long;
          userLoc["coordinates"][1] = user_lat;
          // use userLoc to sort distances of stores

I dont get the event object on pressing the getCurrentPosition() so I can’t the same thing. How do I do that?