Skip to content

Commit

Permalink
getListLocations -> getLocations (stripe#162)
Browse files Browse the repository at this point in the history
* getListLocations -> getLocations

* rename params as well
  • Loading branch information
jdivock-stripe authored and arekkubaczkowski committed Jun 29, 2022
1 parent 0b8d101 commit 145b745
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) :

@ReactMethod
@Suppress("unused")
fun getListLocations(params: ReadableMap, promise: Promise) {
fun getLocations(params: ReadableMap, promise: Promise) {
val listParameters = ListLocationsParameters.Builder()
listParameters.endingBefore = getStringOr(params, "endingBefore")
listParameters.startingAfter = getStringOr(params, "startingAfter")
Expand All @@ -565,7 +565,7 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) :
override fun onSuccess(locations: List<Location>, hasMore: Boolean) {
val list = mapFromListLocations(locations)
val result = WritableNativeMap()
result.putArray("locationsList", list)
result.putArray("locations", list)
result.putBoolean("hasMore", hasMore)
promise.resolve(result)
}
Expand Down
8 changes: 4 additions & 4 deletions example/src/screens/LocationListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export default function LocationListScreen() {
const navigation = useNavigation();
const { params } = useRoute<RouteProp<any, any>>();

const { getListLocations, loading } = useStripeTerminal();
const { getLocations, loading } = useStripeTerminal();
const [list, setList] = useState<Location[]>([]);

useEffect(() => {
async function init() {
const { locationsList } = await getListLocations({ limit: 20 });
if (locationsList) {
setList(locationsList);
const { locations } = await getLocations({ limit: 20 });
if (locations) {
setList(locations);
}
}
init();
Expand Down
Loading

0 comments on commit 145b745

Please sign in to comment.