Skip to content

Location Hooks

Mario Pérez edited this page Mar 13, 2023 · 2 revisions

Hooks exported by src/app/services/Location.tsx

useGetLocationsQuery()

Get the full list of locations from the API

Use

const { locations, error, isLoading } = useGetLocationsQuery();

useAddLocationMutation()

Sends a request to the API in order to create a new location

Use

const { addLocation, {isLoading: isUpdating} } = useAddLocationMutation();
//or
const { addLocation, result } = useAddLocationMutation();
const {isLoading: isUpdating} = result;