Created
July 20, 2021 18:53
-
-
Save samwightt/e1db4e17734d604bcf3e557b1ba5823a 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
import currentUser from "app/auth/queries/currentUser" | |
// You'd need some sort of transform to evaluate this function and turn it into an object | |
// that could be passed to the server. You could just replace the definition of the `currentUser` | |
// function with: | |
// const currentUser = (args) => args | |
// and then just send the returned params to the server. | |
export const query = currentUser(); | |
// This displays when the query is loading. | |
export const loading = () => <h1>Loading...</h1> | |
// This displays if the query is empty. | |
export const empty = () => <h1>You're not logged in :(</h1> | |
// This displays if there was some fetch error. | |
export const error = () => <h1>It looks like there was an error :(</h1> | |
// Finally, this shows up if the data was loaded correctly. | |
export const data = ({ data: currentUser }) => <h1>Hello there, {currentUser.name]!</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment