Last active
December 3, 2019 09:23
-
-
Save bogdanq/f561f4f29b882257ac78a952c84b3e95 to your computer and use it in GitHub Desktop.
Компонент для обработки пользователя
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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