Skip to content

Instantly share code, notes, and snippets.

@felippepuhle
Last active August 27, 2020 13:17
Show Gist options
  • Save felippepuhle/bbedfc6685fd67587af9aedabd57afa3 to your computer and use it in GitHub Desktop.
Save felippepuhle/bbedfc6685fd67587af9aedabd57afa3 to your computer and use it in GitHub Desktop.
import { UserAPI } from '@datasources'
import { GraphQLType, getGlobalId, updateLocalUser } from '@relay'
// ...
const onPressBlockUser = useCallback(async (blockedUserId: string) => {
await UserAPI.blockUser({ blockedUserId })
updateLocalUser(
getGlobalId({ type: GraphQLType.USER, resourceId: blockedUserId }),
() => ({ isBlocked: true })
)
}, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment