Skip to content

Commit b61854e

Browse files
committed
fix: state update error
1 parent 3de74dc commit b61854e

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

src/components/player/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useContext, createContext } from 'react';
22
import ReactDOM from 'react-dom';
3-
import { Container, Button, Overlay, Inner } from './styles/player';
3+
import { Container, Button, Overlay, Inner, Close } from './styles/player';
44

55
export const PlayerContext = createContext();
66

@@ -24,6 +24,7 @@ Player.Video = function PlayerVideo({ ...restProps }) {
2424
<video id="netflix-player" controls>
2525
<source src="/videos/bunny.mp4" type="video/mp4" />
2626
</video>
27+
<Close />
2728
</Inner>
2829
</Overlay>,
2930
document.body

src/constants/routes.js

-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export const HOME = '/';
22
export const BROWSE = '/browse';
33
export const SIGN_UP = '/signup';
44
export const SIGN_IN = '/signin';
5-
export const PASSWORD_FORGET = '/password-reset';

src/pages/signin.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ export default function Signin() {
2323
.auth()
2424
.signInWithEmailAndPassword(emailAddress, password)
2525
.then(() => {
26-
setEmailAddress('');
27-
setPassword('');
28-
setError('');
2926
history.push(ROUTES.BROWSE);
3027
})
31-
.catch((error) => setError(error.message));
28+
.catch((error) => {
29+
setEmailAddress('');
30+
setPassword('');
31+
setError(error.message);
32+
});
3233
};
3334

3435
return (

src/pages/signup.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ export default function Signup() {
3030
photoURL: Math.floor(Math.random() * 5) + 1,
3131
})
3232
.then(() => {
33-
setEmailAddress('');
34-
setPassword('');
35-
setError('');
3633
history.push(ROUTES.BROWSE);
3734
})
3835
)
39-
.catch((error) => setError(error.message));
36+
.catch((error) => {
37+
setEmailAddress('');
38+
setPassword('');
39+
setError(error.message);
40+
});
4041
};
4142

4243
return (

0 commit comments

Comments
 (0)