Skip to content

Instantly share code, notes, and snippets.

@gilo
Last active May 20, 2019 08:40
Show Gist options
  • Save gilo/67e1534c40983b668f25ff9283f7d160 to your computer and use it in GitHub Desktop.
Save gilo/67e1534c40983b668f25ff9283f7d160 to your computer and use it in GitHub Desktop.
import React from 'react';
import {PageHeader, Button, Link} from '@appsflyer/fe-components-core';
import {GET} from '@appsflyer/fe-services';
class LandJoke extends React.Component {
constructor(props) {
super(props);
this.state = {
joke: "placeholder joke",
account: "",
user: "placeholder user"
};
//this.setRandJoke(); TODO connect joker to apigateway and uncomment
//this.getSomeUserMetadata(); TODO create relevant route on server.clj and uncomment
}
getSomeUserMetadata(){
let url = '/crm/get-some-user-metadata';
GET(url).then(result => {
if (!result.error) {
this.setState({
user: result
});
}
});
}
setRandJoke = () => {
let url = '/joker/get-rand';
GET(url).then(result => {
if (!result.error) {
this.setState({
joke: result
});
}
});
}
render() {
return (
<div style={{'padding': '40px'}}>
<PageHeader title="rand joke"></PageHeader>
<div style={{'padding': '20px 20px 20px 0px'}}>
Hello
{'\n'}
{this.state.user}
, here's your random joke:
{'\n'}
{this.state.joke}
</div>
<Button
color="blue"
iconClass="fa-search"
disableBlurAfterClick
//onClick={this.setRandJoke} TODO uncomment once joker is connected & working
size="medium"
text="Hit me another one!"
stopPropagation
preventDefault
/>
<Link style={{'float':'right'}}
arrow
href="/crm/search">
Continue to CRM
</Link>
</div>
)
}
}
export default LandJoke;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment