From the course: Learning AWS Amplify (2020)

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Fetch items from the server

Fetch items from the server - Amazon Web Services (AWS) Tutorial

From the course: Learning AWS Amplify (2020)

Start my 1-month free trial

Fetch items from the server

- [Instructor] Okay, well let's keep this train goin'. Now that we've sent some data up to the cloud, we got to bring that data home. And we need to fetch it from the server. So I'm going to write a new function to fetch the data. So on line 225, I'm going to write func, fetch items, and it's going to take a completion handler so we know when it's done, and I'm going to mark it as escaping too, so we can call it from the return of another call. And it's going to take a bool, that'll be success or not, and return void. Okay, so instead of creating an input and a mutation, we're going to create a query and set a filter on it. So on line 226, I'ma type let Q equal list picos query, open close paren, and then I'm going to create some items for the filter. So on line 227, I'll type let filter equal model, and we can compare different things. We're going to compare string, and then we can compare different ways, greater than, less…

Contents