Skip to content

Commit

Permalink
fix: state update error
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhadwen committed Jul 8, 2020
1 parent 3de74dc commit b61854e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/components/player/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useContext, createContext } from 'react';
import ReactDOM from 'react-dom';
import { Container, Button, Overlay, Inner } from './styles/player';
import { Container, Button, Overlay, Inner, Close } from './styles/player';

export const PlayerContext = createContext();

Expand All @@ -24,6 +24,7 @@ Player.Video = function PlayerVideo({ ...restProps }) {
<video id="netflix-player" controls>
<source src="/videos/bunny.mp4" type="video/mp4" />
</video>
<Close />
</Inner>
</Overlay>,
document.body
Expand Down
1 change: 0 additions & 1 deletion src/constants/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ export const HOME = '/';
export const BROWSE = '/browse';
export const SIGN_UP = '/signup';
export const SIGN_IN = '/signin';
export const PASSWORD_FORGET = '/password-reset';
9 changes: 5 additions & 4 deletions src/pages/signin.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export default function Signin() {
.auth()
.signInWithEmailAndPassword(emailAddress, password)
.then(() => {
setEmailAddress('');
setPassword('');
setError('');
history.push(ROUTES.BROWSE);
})
.catch((error) => setError(error.message));
.catch((error) => {
setEmailAddress('');
setPassword('');
setError(error.message);
});
};

return (
Expand Down
9 changes: 5 additions & 4 deletions src/pages/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,14 @@ export default function Signup() {
photoURL: Math.floor(Math.random() * 5) + 1,
})
.then(() => {
setEmailAddress('');
setPassword('');
setError('');
history.push(ROUTES.BROWSE);
})
)
.catch((error) => setError(error.message));
.catch((error) => {
setEmailAddress('');
setPassword('');
setError(error.message);
});
};

return (
Expand Down

0 comments on commit b61854e

Please sign in to comment.