Skip to content

Commit

Permalink
fix: display error message when failed
Browse files Browse the repository at this point in the history
  • Loading branch information
joonas-yoon committed Sep 20, 2022
1 parent db2dd96 commit a9e3c25
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions react-app/src/pages/Auth.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const Logout = () => {
}, [location]);
};

const CallbackOAuth = ({ api_callback_url, icon, children }) => {
const CallbackOAuth = ({ api_callback_url, icon, children, error_message }) => {
const location = useLocation();
const navigate = useNavigate();
const { login } = useAuth();
Expand All @@ -165,7 +165,7 @@ const CallbackOAuth = ({ api_callback_url, icon, children }) => {
replace: true,
state: {
from: location,
message: 'Failed to authroize with Google',
message: error_message,
},
});
});
Expand All @@ -186,23 +186,35 @@ const CallbackOAuth = ({ api_callback_url, icon, children }) => {

const CallbackGoogle = () => {
return (
<CallbackOAuth api_callback_url="/auth/google/callback" icon={<FcGoogle />}>
<CallbackOAuth
api_callback_url="/auth/google/callback"
icon={<FcGoogle />}
error_message="Failed to authroize with Google"
>
<Typography>Waiting for Google Sign-in to complete...</Typography>
</CallbackOAuth>
);
};

const CallbackGithub = () => {
return (
<CallbackOAuth api_callback_url="/auth/github/callback" icon={<FaGithub />}>
<CallbackOAuth
api_callback_url="/auth/github/callback"
icon={<FaGithub />}
error_message="Failed to authroize with GitHub"
>
<Typography>Waiting for GitHub Sign-in to complete...</Typography>
</CallbackOAuth>
);
};

const CallbackKakao = () => {
return (
<CallbackOAuth api_callback_url="/auth/kakao/callback" icon={<SiKakao />}>
<CallbackOAuth
api_callback_url="/auth/kakao/callback"
icon={<SiKakao />}
error_message="Failed to authroize with Kakao"
>
<Typography>Waiting for Kakao Sign-in to complete...</Typography>
</CallbackOAuth>
);
Expand Down

0 comments on commit a9e3c25

Please sign in to comment.