Skip to content

Commit

Permalink
signup progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ragzor committed Apr 16, 2019
1 parent 6b8ce08 commit f00f3d0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
8 changes: 4 additions & 4 deletions auth/Auth-lame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Auth extends React.Component<AuthProps, AuthState> {
}
);

// TODO: find if sub is the ID of user
// @todo find if sub is the ID of user
}
);
};
Expand All @@ -105,7 +105,7 @@ class Auth extends React.Component<AuthProps, AuthState> {

setSession = (data: SessionDatatype) => {
const user = {
// TODO: Add correct user details here
// @todo Add correct user details here
id: data.user.id,
role: 'JOBSEEKER',
};
Expand All @@ -114,7 +114,7 @@ class Auth extends React.Component<AuthProps, AuthState> {
accessToken: data.token,
user,
});
// TODO: check if localstorage is available or not and if it isn't use
// @todo check if localstorage is available or not and if it isn't use
// cookies to set session instead.
const isBrowser = typeof window !== 'undefined';
if (isBrowser) {
Expand Down Expand Up @@ -188,7 +188,7 @@ class Auth extends React.Component<AuthProps, AuthState> {
// Remove localstorage token
const isBrowser = typeof window !== 'undefined';
if (isBrowser) {
window.localStorage.removeItem('token'); // TODO: Get a better token name LOL
window.localStorage.removeItem('token'); // @todo Get a better token name LOL
}

// clear apollo store
Expand Down
2 changes: 1 addition & 1 deletion auth/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface LoginFormValues {
email: string;
password: string;
}
// TODO: convert it to SFC
// @todo convert it to SFC
class Login extends Component<LoginProps, LoginState> {
LoginSchema = Yup.object().shape({
email: Yup.string()
Expand Down
6 changes: 3 additions & 3 deletions auth/SignupForm.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { Formik, Field, FormikProps, FieldProps, Form } from 'formik';
import * as Yup from 'yup';
import { authorize, authorizeWithGoogle } from '../../tools/auth/auth0';
import { signup, authorizeWithGoogle } from '../../tools/auth/auth0';
import styled from 'styled-components';
import Button from '../../../components/Button';
import SocialButton from '../../../components/SocialButton';
Expand Down Expand Up @@ -36,7 +36,7 @@ interface SignupFormValues {
email: string;
password: string;
}
// TODO: convert it to SFC
// @todo convert it to SFC
class Signup extends Component<SignupProps, SignupState> {
SignupSchema = Yup.object().shape({
name: Yup.string().required('Please fill out your name!'),
Expand All @@ -61,7 +61,7 @@ class Signup extends Component<SignupProps, SignupState> {
onSubmit={(values, { setSubmitting, setStatus }) => {
let { email, password, name } = values;
// Try to Signup the user, if Signup doesn't happen throw the error
authorize(email, password);
signup(email, password);
// .catch((e: any) => {
// console.log(e.graphQLErrors);
// setStatus({
Expand Down
14 changes: 10 additions & 4 deletions auth/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ export const authorize = (email, password) =>
email,
password,
},
e => {
console.log(e);
err => {
console.log(err);
}
);
export const authorizeWithGoogle = () => {
getAuth0().authorize({
connection: 'google-oauth2',
});
};
export const signup = () => {
// getAuth0().signup();
export const signup = (email, password) => {
// @todo save name as meta deta in auth0 database
getAuth0().signup(
{ connection: 'Username-Password-Authentication', email, password },
err => {
console.log(err);
}
);
};
export const logout = () => getAuth0().logout({ returnTo: getBaseUrl() });
export const parseHash = callback => getAuth0().parseHash(callback);
2 changes: 1 addition & 1 deletion form/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const FloatingLabel = styled.label`
margin-left: 15px; /* Should be same as input margin left */
line-height: 56px;
/* To also make the label clickable */
// TODO: label is not clickable because z-index is not -1
// @todo label is not clickable because z-index is not -1
z-index: 1;
transition: all 150ms ease;
`;
Expand Down

0 comments on commit f00f3d0

Please sign in to comment.