Skip to content

Commit

Permalink
Merge pull request #47 from jaroslavhuss/TECH__error-messages
Browse files Browse the repository at this point in the history
Display errors from manage pages properly through error reducer
  • Loading branch information
jaroslavhuss authored May 30, 2022
2 parents 60da0a1 + 2fdaa6d commit 64da458
Show file tree
Hide file tree
Showing 4 changed files with 466 additions and 299 deletions.
58 changes: 34 additions & 24 deletions client/src/components/Error.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
import { useDispatch } from "react-redux";
import { cleanError } from "../store/reducers/errorReducer"
const Error = ({ errorMessage }: { errorMessage: [] }) => {
const dispatch = useDispatch();
console.log(errorMessage)
return (
<div style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
position: "fixed",
zIndex: 99999,
width: "100%",
height: "100%",
background: "#e5e5e5d1"
}}
onClick={() => {
dispatch(cleanError());
}}
>
{
// errorMessage.map((err, index) => <p key={index} style={{ color: "red", padding: 40, background: "white", borderRadius: 12 }}>{err}</p>)
}
import { cleanError, ErrorStateAlert } from "../store/reducers/errorReducer";

</div>
);
const Error = ({ errorMessage }: { errorMessage: Array<ErrorStateAlert> }) => {
const dispatch = useDispatch();
return (
<div
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
position: "fixed",
zIndex: 99999,
width: "100%",
height: "100%",
background: "#e5e5e5d1",
}}
onClick={() => {
dispatch(cleanError());
}}
>
{errorMessage.map((err, index) => (
<p
key={index}
style={{
color: "red",
padding: 40,
background: "white",
borderRadius: 12,
}}
>
{err.message}
</p>
))}
</div>
);
};

export default Error;
Loading

0 comments on commit 64da458

Please sign in to comment.