200407_TIL
main
property or a 500
propertyimport React from 'react';
import { createMuiTheme } from '@material-ui/core/styles';
import { ThemeProvider } from '@material-ui/styles';
import { purple } from '@material-ui/core/colors';
import Button from '@material-ui/core/Button';
const theme = createMuiTheme({
palette: {
primary: {
// Purple and green play nicely together.
main: purple[500], //* 필수
},
secondary: {
// This is green.A700 as hex.
main: '#11cb5f', //* 필수
},
},
});
export default function Palette() {
return (
<ThemeProvider theme={theme}>
<Button color="primary">Primary</Button>
<Button color="secondary">Secondary</Button>
</ThemeProvider>
);
}
// Login.js
return (
<div className="login">
<GoogleLogin
clientId={GOOGLE_CLIENT_ID} //-> google access token -> Custard server에 전송
//custard server는 google access token
//구글 로그인 아이콘 바꾸려면:
render={renderProps => (
<Button
id="google-login-button"
onClick={renderProps.onClick}
disabled={renderProps.disabled}
>
<img src={google_logo_2} className="google-logo" />
Sign in with Google
</Button>
)}
onSuccess={function(result) {
console.log(result);
console.log(result.tokenObj["id_token"]);
this.props.setTempToken(result.tokenObj["id_token"]);
axios
.post("/users/signin", {
googleIdToken: result.tokenObj["id_token"]
})
.then(response => {
console.log("서버요청결과", response);
console.log(response.data == "you need to signup");
if (response.data == "you need to signup") {
this.setState({ needSignUp: true });
} else if (response.status === 200) {
//console.log("code 200!");
console.log(response.data); //{username: "Min", image: "/account.png"}
localStorage.setItem("usertoken", response.data);
localStorage.removeItem(localStorage);
this.props.setLogin();
this.props.updateUserInfo(response.data);
return <Redirect to="/mypage" />;
}
});
*/
//this.props.requestLogin(result);
}.bind(this)}
onFailure={err => console.log(err)}
/>
{/*<Link to="/signup">회원가입</Link>*/}
</div>