πŸ“„
Docs
  • πŸ’»Gateway Server and API Docs
  • πŸ“”Client-Side Helper Functions
  • πŸ—ΊοΈMapping
  • πŸ””Notifications
  • 😎HoloLens
  • πŸ› οΈTSS Utility Routes
  • πŸ§ͺTest Routes
Powered by GitBook
On this page

Client-Side Helper Functions

Here's some information on how you can use the client-side helper functions in the LMCC to interface with the Python/Flask API

PreviousGateway Server and API DocsNextMapping

Last updated 1 year ago

All of these functions can be found under .

You can skip this file if you are not developing for the LMCC Frontend application.

While these have been documented within the code itself with detailed comments, here's a quick rundown:

  • fetchWithoutParams -> This function allows you to set a interface type and a path to fetch the JSON object at that path. Here's an example usage:

// from client/components/ui/map.tsx

interface GeoJSON {
    type: 'FeatureCollection';
    features: string[];
    ...
}

const data = await fetchWithoutParams<GeoJSON>('api/v0?get=map_info');
if (data && data.features) {
    setPoints(data.features);
}
  • fetchWithParams -> This function fetches you a JSON object or makes a POST request with optional JSONified Params

    • An example usage can be found in map.tsx, similar to the example above, on Line 124.

  • fetchImageWithParams is only meant for Map usage at the time being, so docs will be added as needed. If you have to use it, take a look at the code comments.

πŸ“”
SUITS-2024-LMCC/client/api/fetchServer.ts