In the notes app, users can only view and modify their own notes. We will add authorization rules to our data model so that the data is protected and can only be accessed by the owner of the data.
data tab under Setup. Then click the Note model. Enable Enable Owner Authorization. Select all activities. Delete an existing rule.
Then click Save and Deploy.amplify pull in your CLI to sync your changes locally.import { DataStore } from 'aws-amplify'
NavBar component, add the following line of code to clear local data before logging out.
<NavBar
marginBottom='20px' width='100%'
overrides={{
Button31502513: { onClick: () => setShowCreateModal(true) },
Button31502517: {
onClick: async() => {
+ await DataStore.clear()
signOut()
}
}
}}
/>
We now have authorization rules in our application.