Skip to content

Commit a9e3c25

Browse files
committed
fix: display error message when failed
1 parent db2dd96 commit a9e3c25

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

react-app/src/pages/Auth.jsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const Logout = () => {
145145
}, [location]);
146146
};
147147

148-
const CallbackOAuth = ({ api_callback_url, icon, children }) => {
148+
const CallbackOAuth = ({ api_callback_url, icon, children, error_message }) => {
149149
const location = useLocation();
150150
const navigate = useNavigate();
151151
const { login } = useAuth();
@@ -165,7 +165,7 @@ const CallbackOAuth = ({ api_callback_url, icon, children }) => {
165165
replace: true,
166166
state: {
167167
from: location,
168-
message: 'Failed to authroize with Google',
168+
message: error_message,
169169
},
170170
});
171171
});
@@ -186,23 +186,35 @@ const CallbackOAuth = ({ api_callback_url, icon, children }) => {
186186

187187
const CallbackGoogle = () => {
188188
return (
189-
<CallbackOAuth api_callback_url="/auth/google/callback" icon={<FcGoogle />}>
189+
<CallbackOAuth
190+
api_callback_url="/auth/google/callback"
191+
icon={<FcGoogle />}
192+
error_message="Failed to authroize with Google"
193+
>
190194
<Typography>Waiting for Google Sign-in to complete...</Typography>
191195
</CallbackOAuth>
192196
);
193197
};
194198

195199
const CallbackGithub = () => {
196200
return (
197-
<CallbackOAuth api_callback_url="/auth/github/callback" icon={<FaGithub />}>
201+
<CallbackOAuth
202+
api_callback_url="/auth/github/callback"
203+
icon={<FaGithub />}
204+
error_message="Failed to authroize with GitHub"
205+
>
198206
<Typography>Waiting for GitHub Sign-in to complete...</Typography>
199207
</CallbackOAuth>
200208
);
201209
};
202210

203211
const CallbackKakao = () => {
204212
return (
205-
<CallbackOAuth api_callback_url="/auth/kakao/callback" icon={<SiKakao />}>
213+
<CallbackOAuth
214+
api_callback_url="/auth/kakao/callback"
215+
icon={<SiKakao />}
216+
error_message="Failed to authroize with Kakao"
217+
>
206218
<Typography>Waiting for Kakao Sign-in to complete...</Typography>
207219
</CallbackOAuth>
208220
);

0 commit comments

Comments
 (0)