Skip to content

Instantly share code, notes, and snippets.

@bogdanq
Last active December 3, 2019 09:23
Show Gist options
  • Save bogdanq/f561f4f29b882257ac78a952c84b3e95 to your computer and use it in GitHub Desktop.
Save bogdanq/f561f4f29b882257ac78a952c84b3e95 to your computer and use it in GitHub Desktop.
Компонент для обработки пользователя
export const WithAccount = ({ renderExists, renderEmpty, render }) => {
const { user } = $userStore()
if (user && renderExists) {
return renderExists({ account: user, accountId: user.id })
}
if (!user && renderEmpty) {
return renderEmpty({ account: null, accountId: null })
}
return render
? render({ account: user, accountId: user ? user.id : null })
: null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment