mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-06 02:36:39 +00:00
add blank dev Profile on signup
This commit is contained in:
parent
7ae1082547
commit
12d52d6ec8
2 changed files with 34 additions and 2 deletions
|
|
@ -30,6 +30,31 @@ interface Dev extends DevSummary {
|
|||
export const getDescription = (status: string, company: string) =>
|
||||
`${status} at ${company}`;
|
||||
|
||||
/** blank Dev serve as placeholder when initializing a new profile */
|
||||
export const blankDev: Dev = {
|
||||
id: '42',
|
||||
displayName: '',
|
||||
status: 'Developer',
|
||||
company: '',
|
||||
picture: '',
|
||||
description: '',
|
||||
location: '',
|
||||
skills: [],
|
||||
links: {
|
||||
website: '',
|
||||
instagram: '',
|
||||
facebook: '',
|
||||
linkedin: '',
|
||||
twitter: '',
|
||||
github: '',
|
||||
youtube: '',
|
||||
},
|
||||
bio: '',
|
||||
experiences: [],
|
||||
educations: [],
|
||||
repos: [],
|
||||
};
|
||||
|
||||
/**
|
||||
* sample Dev for development and tests
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import Alert from '../components/Alert';
|
|||
import Header from '../components/Header';
|
||||
// Form
|
||||
import useForm from '../hooks';
|
||||
import {blankDev} from '../models/Dev';
|
||||
|
||||
// extends withFirebaseProps type to ad profile info
|
||||
interface IProps extends WithFirebaseProps<User> {
|
||||
|
|
@ -55,12 +56,18 @@ const SignUp: FC<IProps> = ({firebase, isEmpty, isLoaded}) => {
|
|||
// pass the info to store into the second argument
|
||||
firebase
|
||||
.createUser({email, password}, newUser(name, email))
|
||||
.then(() => resetForm())
|
||||
.then(() => {
|
||||
firebase.updateProfile(blankDev, {useSet: true, merge: true});
|
||||
resetForm();
|
||||
})
|
||||
.catch(err => setError(err));
|
||||
};
|
||||
|
||||
const loginWithGoogle = () =>
|
||||
firebase.login({provider: 'google', type: 'popup'});
|
||||
firebase
|
||||
.login({provider: 'google', type: 'popup'})
|
||||
.then(() => firebase.updateProfile(blankDev, {useSet: true, merge: true}))
|
||||
.catch(err => setError(err));
|
||||
|
||||
// redirect to dashboard if connected
|
||||
if (isLoaded && !isEmpty) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue