useLogIn is a helper function internal to login-hooks.js. This diff refactors the helper function in preparation for a new use case that will be introduced in the next diff.
Right now useLogIn is coupled with the specific forms of login that it supports; this diff makes it more generic.
Depends on D12112