This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// modules.js | |
export function drive(props) { | |
return props.gas | |
} | |
export function fly(props) { | |
return props.miles | |
} | |
// main.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// after all babel and webpack configs | |
import AWS from 'aws-sdk'; | |
import { CognitoUserPool } from 'amazon-cognito-identity-js'; | |
export default function signupHandler(body) { | |
const userData = JSON.parse(body); | |
AWS.config.region = 'us-east-1'; | |
const poolData = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AWS from 'aws-sdk'; | |
import { CognitoUserPool, AuthenticationDetails, CognitoUser } from 'amazon-cognito-identity-js'; | |
export default function signinHandler(body) { | |
const authData = JSON.parse(body); | |
AWS.config.region = 'us-east-1'; | |
const authenticationDetails = { | |
Username: authData.username, | |
Password: authData.password, | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fruits = { | |
apples: 3, | |
bananas: 4, | |
pears: 1, | |
blackberries: 8 | |
} | |
// always check if Storage is available | |
if (typeof(Storage)) { | |
// saving the object (or JSON) to localStorage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// let's define our expiration date | |
const today = new Date(); | |
let expDate = new Date(); | |
expDate.setDate(today.getDate() + 30); // 30 days expiration | |
// a searches user does in your app on the first visit, we collect them to save to localStorage | |
const userRecentlocations = [ | |
{ city: "New York", country: "US", id: "2390230" }, | |
{ city: "Athens", country: "GR", id: "304802" }, | |
{ city: "Kyiv", country: "UA", id: "1239488" } |
OlderNewer