# All files / composer/utils LocationFinder.js

100% Statements 6/6
100% Branches 0/0
100% Functions 4/4
100% Lines 6/6

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24

    2x

    2x
    1x

    2x
    1x
    1x

     import API from './API';
    import ServiceLocation from '../entities/ServiceLocation';

    class LocationFinder {
      static url = 'profiles/get_locations.json';

      static findLocations(profileId, query) {
        const params = {
          profile_id: profileId,
          place: query,
        };

        return API.post(LocationFinder.url, params)
          .catch(() => [])
          .then((response) => {
            const locations = response.locations.data;
            return locations.map((l) =>
              new ServiceLocation(l.id, l.name, l.picture, l.checkins, l.single_line_address)
            );
          });
      }
    }
    export default LocationFinder;