Skip to content

Instantly share code, notes, and snippets.

@MaximBazarov
Created June 23, 2018 13:16
Show Gist options
  • Save MaximBazarov/f5934c915d038e907eb95e9687c6be09 to your computer and use it in GitHub Desktop.
Save MaximBazarov/f5934c915d038e907eb95e9687c6be09 to your computer and use it in GitHub Desktop.
/// Action creator
func downloadProfile(state: ApplicationState) -> Action {
return Downloader.DownloadUserProfile(
baseURL: state.api.profile.baseURL
endpoint: state.api.profile.getProfile
profileID: state.profile.id
authToken: state.auth.token
retryCount: state.api.retryCount
)
}
// then our method is just
func profileScreenisAboutToAppear() {
core.dispatch(action: downloadProfile(state: state))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment