diff --git a/src/components/common/Auth/GoogleLoginButton.js b/src/components/common/Auth/GoogleLoginButton.js deleted file mode 100644 index 4b69a4b8b..000000000 --- a/src/components/common/Auth/GoogleLoginButton.js +++ /dev/null @@ -1,34 +0,0 @@ -import React, { useEffect, useRef } from 'react'; -import PropTypes from 'prop-types'; -import { useContext } from 'react'; -import GoogleContext from 'contexts/GoogleContext'; -import { useIsLoggedIn } from 'hooks/auth'; - -const GoogleLoginButton = ({ onSuccess }) => { - const googleAuth = useContext(GoogleContext); - const ref = useRef(null); - - // use ref in case onSuccess is mutable - const onSuccessRef = useRef(onSuccess); - const isLoggedIn = useIsLoggedIn(); - - useEffect(() => { - if (googleAuth && ref.current) { - googleAuth.renderButton(ref.current, {}); - } - }, [googleAuth]); - - useEffect(() => { - if (isLoggedIn) { - onSuccessRef.current(); - } - }, [isLoggedIn]); - - return
Google 登入
; -}; - -GoogleLoginButton.propTypes = { - onSuccess: PropTypes.func.isRequired, -}; - -export default GoogleLoginButton;