fix profile linking

This commit is contained in:
Berkeley Martinez
2015-08-21 16:08:49 -07:00
parent d5c6a54923
commit 0f3acc629c
6 changed files with 37 additions and 17 deletions

View File

@ -1,5 +1,21 @@
import assign from 'object.assign';
const providerHash = {
facebook: ({ id }) => id,
twitter: ({ username }) => username,
linkedin({ _json }) {
return _json && _json.publicProfileUrl || null;
},
google: ({ id }) => id
};
export function getUsernameFromProvider(provider, profile) {
console.log(profile);
return typeof providerHash[provider] === 'function' ?
providerHash[provider](profile) :
null;
}
// using es6 argument destructing
export function setProfileFromGithub(
user,