Date: Sat, 12 Oct 2019 18:28:02 +0900
Subject: [PATCH 10/50] console.log(msg) miss
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 5b3f37d..8112c93 100644
--- a/src/App.js
+++ b/src/App.js
@@ -20,8 +20,8 @@ class LambdaDemo extends Component {
}
render() {
- console.log(msg)
const { loading, msg } = this.state
+ console.log(msg)
return (
From e7b35268121cd6e778a1bdee350cad1dd8bbf210 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sat, 12 Oct 2019 18:36:23 +0900
Subject: [PATCH 11/50] asdfghjkl
---
src/lambda/async-dadjoke.js | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index c28d10f..2c12463 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -10,12 +10,20 @@ export async function handler (event, context) {
const res = await client.tournaments.show({
id: 'n18011test',
callback: (err, data) => {
- console.log(data)
- return data
+ try {
+ console.log(data)
+ return {
+ statusCode: 200,
+ body: JSON.stringify({ msg: res })
+
+ }
+ } catch (err) {
+ console.log(err) // output to netlify function log
+ return {
+ statusCode: 500,
+ body: JSON.stringify({ msg: err.message }) // Could be a custom message or object i.e. JSON.stringify(err)
+ }
+ }
}
})
- return {
- statusCode: 200,
- body: JSON.stringify({ msg: res })
- }
}
From fe0e46a74076cc23eb5b57e7bbe774f4360776f8 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sat, 12 Oct 2019 18:41:43 +0900
Subject: [PATCH 12/50] qwertyuiop
---
src/lambda/async-dadjoke.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 2c12463..6260e52 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -7,14 +7,14 @@ const client = challonge.createClient({
})
export async function handler (event, context) {
- const res = await client.tournaments.show({
+ await client.tournaments.show({
id: 'n18011test',
callback: (err, data) => {
try {
console.log(data)
return {
statusCode: 200,
- body: JSON.stringify({ msg: res })
+ body: JSON.stringify({ msg: data })
}
} catch (err) {
From 7d4a310fd6d791eab92f97447ed12b068fd4ba5d Mon Sep 17 00:00:00 2001
From: n18011
Date: Sat, 12 Oct 2019 18:50:28 +0900
Subject: [PATCH 13/50] zxcvbnm
---
src/App.js | 4 +---
src/lambda/async-dadjoke.js | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/App.js b/src/App.js
index 8112c93..5f059d1 100644
--- a/src/App.js
+++ b/src/App.js
@@ -13,9 +13,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
fetch("/.netlify/functions/" + api)
- .then(response => {
- return response.json()}
- )
+ .then(response => response.json())
.then(json => this.setState({ loading: false, msg: json }))
}
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 6260e52..9dda809 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -7,7 +7,7 @@ const client = challonge.createClient({
})
export async function handler (event, context) {
- await client.tournaments.show({
+ client.tournaments.show({
id: 'n18011test',
callback: (err, data) => {
try {
From ca47e3aea9c16f358a3ef1269371bd0b7874dedd Mon Sep 17 00:00:00 2001
From: n18011
Date: Sat, 12 Oct 2019 18:55:09 +0900
Subject: [PATCH 14/50] fetch res => res
---
src/App.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/App.js b/src/App.js
index 5f059d1..812890b 100644
--- a/src/App.js
+++ b/src/App.js
@@ -13,8 +13,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
fetch("/.netlify/functions/" + api)
- .then(response => response.json())
- .then(json => this.setState({ loading: false, msg: json }))
+ .then(res => this.setState({ loading: false, msg: res }))
}
render() {
From 45f8baad7928c24abeb2e8c16b8e28f2331e3509 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sat, 12 Oct 2019 19:00:08 +0900
Subject: [PATCH 15/50] return add
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 9dda809..0475124 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -7,7 +7,7 @@ const client = challonge.createClient({
})
export async function handler (event, context) {
- client.tournaments.show({
+ return client.tournaments.show({
id: 'n18011test',
callback: (err, data) => {
try {
From 4ca834355c011aee6213ff915f7ba79214a12aae Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 00:20:37 +0900
Subject: [PATCH 16/50] test
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 0475124..6260e52 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -7,7 +7,7 @@ const client = challonge.createClient({
})
export async function handler (event, context) {
- return client.tournaments.show({
+ await client.tournaments.show({
id: 'n18011test',
callback: (err, data) => {
try {
From b4a309a99245b79fbb4aa168f42aeb2869c579dd Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 00:43:32 +0900
Subject: [PATCH 17/50] axios test
---
src/lambda/async-dadjoke.js | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 6260e52..adb71db 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -1,29 +1,25 @@
// example of async handler using async-await
// https://github.com/netlify/netlify-lambda/issues/43#issuecomment-444618311
+import axios from 'axios'
const challonge = require('challonge')
const client = challonge.createClient({
apiKey: 'THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU'
})
export async function handler (event, context) {
- await client.tournaments.show({
- id: 'n18011test',
- callback: (err, data) => {
- try {
- console.log(data)
- return {
- statusCode: 200,
- body: JSON.stringify({ msg: data })
-
- }
- } catch (err) {
- console.log(err) // output to netlify function log
- return {
- statusCode: 500,
- body: JSON.stringify({ msg: err.message }) // Could be a custom message or object i.e. JSON.stringify(err)
- }
- }
+ try {
+ const response = await axios.get(`https://n18011:${process.env.APIKEY}@api.challonge.com/v1/tournaments.json`, { headers: { Accept: 'application/json' } })
+ const data = response.data
+ return {
+ statusCode: 200,
+ body: JSON.stringify({ msg: data })
+ }
+ } catch (err) {
+ console.log(err) // output to netlify function log
+ return {
+ statusCode: 500,
+ body: JSON.stringify({ msg: err.message }) // Could be a custom message or object i.e. JSON.stringify(err)
}
- })
+ }
}
From 4631ab34558d5e21c6311ed7814121031f67f8d2 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 15:59:06 +0900
Subject: [PATCH 18/50] use superagent
---
src/App.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/App.js b/src/App.js
index 812890b..ab1a0db 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,6 +1,7 @@
import React, { Component } from "react"
import logo from "./logo.svg"
import "./App.css"
+import request from 'superagent'
class LambdaDemo extends Component {
constructor(props) {
@@ -12,8 +13,9 @@ class LambdaDemo extends Component {
e.preventDefault()
this.setState({ loading: true })
- fetch("/.netlify/functions/" + api)
- .then(res => this.setState({ loading: false, msg: res }))
+ request.get("/.netlify/functions/" + api)
+ .accept('application/json')
+ .end(res => this.setState({ loading: false, msg: res.body }))
}
render() {
From 73034ad62b228e6e39410978fa9566ea882de0b8 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:02:49 +0900
Subject: [PATCH 19/50] retry use superagent
---
package-lock.json | 145 ++++++++++++++++++++++++++++++++++++++++++++++
package.json | 3 +-
2 files changed, 147 insertions(+), 1 deletion(-)
diff --git a/package-lock.json b/package-lock.json
index 496f718..d978c50 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -4,11 +4,72 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
+ },
"challonge": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/challonge/-/challonge-2.2.0.tgz",
"integrity": "sha512-7OhS4yZiUWCU8CBoadlB5Vb5EMb1mQuEVXkE9P8f5YYCd0LC4z3WhDN5uCx0swdpltZhPStxFY+2ZztWiN696Q=="
},
+ "combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
+ "component-emitter": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
+ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
+ },
+ "cookiejar": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz",
+ "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
+ },
+ "debug": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
+ "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
+ },
+ "fast-safe-stringify": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz",
+ "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA=="
+ },
+ "form-data": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
+ "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
+ "requires": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.6",
+ "mime-types": "^2.1.12"
+ }
+ },
+ "formidable": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.1.tgz",
+ "integrity": "sha512-Fs9VRguL0gqGHkXS5GQiMCr1VhZBxz0JnJs4JmMp/2jL18Fmbzvv7vOFRU+U8TBkHEE/CX1qDXzJplVULgsLeg=="
+ },
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
+ },
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -22,6 +83,34 @@
"js-tokens": "^3.0.0 || ^4.0.0"
}
},
+ "methods": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
+ "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
+ },
+ "mime": {
+ "version": "2.4.4",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.4.tgz",
+ "integrity": "sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA=="
+ },
+ "mime-db": {
+ "version": "1.40.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz",
+ "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA=="
+ },
+ "mime-types": {
+ "version": "2.1.24",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz",
+ "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==",
+ "requires": {
+ "mime-db": "1.40.0"
+ }
+ },
+ "ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+ },
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -37,6 +126,11 @@
"react-is": "^16.8.1"
}
},
+ "qs": {
+ "version": "6.9.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.0.tgz",
+ "integrity": "sha512-27RP4UotQORTpmNQDX8BHPukOnBP3p1uUJY5UnDhaJB+rMt9iMsok724XL+UHU23bEFOHRMQ2ZhI99qOWUMGFA=="
+ },
"react": {
"version": "16.10.2",
"resolved": "https://registry.npmjs.org/react/-/react-16.10.2.tgz",
@@ -63,6 +157,21 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.10.2.tgz",
"integrity": "sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA=="
},
+ "readable-stream": {
+ "version": "3.4.0",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz",
+ "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==",
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz",
+ "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg=="
+ },
"scheduler": {
"version": "0.16.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.16.2.tgz",
@@ -71,6 +180,42 @@
"loose-envify": "^1.1.0",
"object-assign": "^4.1.1"
}
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
+ },
+ "string_decoder": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
+ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
+ "requires": {
+ "safe-buffer": "~5.2.0"
+ }
+ },
+ "superagent": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/superagent/-/superagent-5.1.0.tgz",
+ "integrity": "sha512-7V6JVx5N+eTL1MMqRBX0v0bG04UjrjAvvZJTF/VDH/SH2GjSLqlrcYepFlpTrXpm37aSY6h3GGVWGxXl/98TKA==",
+ "requires": {
+ "component-emitter": "^1.3.0",
+ "cookiejar": "^2.1.2",
+ "debug": "^4.1.1",
+ "fast-safe-stringify": "^2.0.6",
+ "form-data": "^2.3.3",
+ "formidable": "^1.2.1",
+ "methods": "^1.1.2",
+ "mime": "^2.4.4",
+ "qs": "^6.7.0",
+ "readable-stream": "^3.4.0",
+ "semver": "^6.1.1"
+ }
+ },
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
}
}
}
diff --git a/package.json b/package.json
index b4a9b5f..1178211 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,8 @@
"challonge": "^2.2.0",
"react": "^16.10.2",
"react-dom": "^16.10.2",
- "react-scripts": "^3.0.1"
+ "react-scripts": "^3.0.1",
+ "superagent": "^5.1.0"
},
"scripts": {
"start": "react-scripts start",
From c6b3d1508dddfb870c007f51ff3800669d4f1312 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:06:22 +0900
Subject: [PATCH 20/50] del res.body
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index ab1a0db..43725f5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end(res => this.setState({ loading: false, msg: res.body }))
+ .end((err, res) => this.setState({ loading: false, msg: res }))
}
render() {
From 60c0c0d95a5f033fb1c65982b70d49390a5fe9a7 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:12:43 +0900
Subject: [PATCH 21/50] body data change
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index adb71db..7e91cc9 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -13,7 +13,7 @@ export async function handler (event, context) {
const data = response.data
return {
statusCode: 200,
- body: JSON.stringify({ msg: data })
+ body: data
}
} catch (err) {
console.log(err) // output to netlify function log
From de820291a8b75a4dcee9bbdda8ee8b5872fc5d59 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:15:28 +0900
Subject: [PATCH 22/50] JSON.stringify add
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 7e91cc9..5e8cf96 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -13,7 +13,7 @@ export async function handler (event, context) {
const data = response.data
return {
statusCode: 200,
- body: data
+ body: JSON.stringify(data)
}
} catch (err) {
console.log(err) // output to netlify function log
From c90fd1c7676424a3c63fdc10414ce053c7dee91f Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:19:01 +0900
Subject: [PATCH 23/50] app add mas.text
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 43725f5..9ead76c 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end((err, res) => this.setState({ loading: false, msg: res }))
+ .end((err, res) => this.setState({ loading: false, msg: res.text }))
}
render() {
From db4f5000bbefc70e25fbcb35273a33ffa471094a Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:22:44 +0900
Subject: [PATCH 24/50] res.body
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 9ead76c..c8a7a9b 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end((err, res) => this.setState({ loading: false, msg: res.text }))
+ .end((err, res) => this.setState({ loading: false, msg: res.body }))
}
render() {
From e9e6796e9e8aea206df82878a5b658686191eec4 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:26:40 +0900
Subject: [PATCH 25/50] add ()
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index c8a7a9b..a2010f7 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end((err, res) => this.setState({ loading: false, msg: res.body }))
+ .end((err, res) => this.setState({ loading: false, msg: res.body() }))
}
render() {
From 9e8766389d5bada77b058aa495bf07dc045d84f8 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:34:01 +0900
Subject: [PATCH 26/50] asdfa
---
src/App.js | 2 +-
src/lambda/async-dadjoke.js | 20 ++++++--------------
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/App.js b/src/App.js
index a2010f7..43725f5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end((err, res) => this.setState({ loading: false, msg: res.body() }))
+ .end((err, res) => this.setState({ loading: false, msg: res }))
}
render() {
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 5e8cf96..dc28848 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -1,25 +1,17 @@
// example of async handler using async-await
// https://github.com/netlify/netlify-lambda/issues/43#issuecomment-444618311
-import axios from 'axios'
const challonge = require('challonge')
const client = challonge.createClient({
apiKey: 'THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU'
})
export async function handler (event, context) {
- try {
- const response = await axios.get(`https://n18011:${process.env.APIKEY}@api.challonge.com/v1/tournaments.json`, { headers: { Accept: 'application/json' } })
- const data = response.data
- return {
- statusCode: 200,
- body: JSON.stringify(data)
+ client.tournaments.show({
+ id: 'n18011',
+ callback: (err, data) => {
+ console.log(err, data)
+ return data
}
- } catch (err) {
- console.log(err) // output to netlify function log
- return {
- statusCode: 500,
- body: JSON.stringify({ msg: err.message }) // Could be a custom message or object i.e. JSON.stringify(err)
- }
- }
+ })
}
From 2c8b439326e4e850041b0a814725903eeb74213b Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:37:54 +0900
Subject: [PATCH 27/50] add return
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index dc28848..d7559cd 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -7,7 +7,7 @@ const client = challonge.createClient({
})
export async function handler (event, context) {
- client.tournaments.show({
+ return client.tournaments.show({
id: 'n18011',
callback: (err, data) => {
console.log(err, data)
From 906b97eab7c30b6369cc31727f560ad6f6eaca8d Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 16:59:35 +0900
Subject: [PATCH 28/50] dasfa
---
src/lambda/async-dadjoke.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index d7559cd..cc97080 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -7,11 +7,16 @@ const client = challonge.createClient({
})
export async function handler (event, context) {
- return client.tournaments.show({
+ const data = () => {
+ client.tournaments.show({
id: 'n18011',
callback: (err, data) => {
console.log(err, data)
return data
}
})
+ }
+ return {
+ status: 200,
+ body : {msg: data()}
}
From a04b77f68c0857deaeceda15a21bc3844b6ee3c1 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:03:33 +0900
Subject: [PATCH 29/50] asdfafasfa
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index cc97080..6254e58 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -18,5 +18,5 @@ export async function handler (event, context) {
}
return {
status: 200,
- body : {msg: data()}
+ body : data()
}
From 736de571f65de980411b11630bb0fb306e7080d7 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:08:43 +0900
Subject: [PATCH 30/50] qrqweporu
---
src/App.js | 2 +-
src/lambda/async-dadjoke.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/App.js b/src/App.js
index 43725f5..9ead76c 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,7 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end((err, res) => this.setState({ loading: false, msg: res }))
+ .end((err, res) => this.setState({ loading: false, msg: res.text }))
}
render() {
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 6254e58..cc97080 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -18,5 +18,5 @@ export async function handler (event, context) {
}
return {
status: 200,
- body : data()
+ body : {msg: data()}
}
From 1def335633429e8e210040d26d48f809307b4ffb Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:14:31 +0900
Subject: [PATCH 31/50] zxvz
---
src/App.js | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 9ead76c..5748422 100644
--- a/src/App.js
+++ b/src/App.js
@@ -15,7 +15,11 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
request.get("/.netlify/functions/" + api)
.accept('application/json')
- .end((err, res) => this.setState({ loading: false, msg: res.text }))
+ .end((err, res) => {
+ if (err) {
+ return
+ }
+ this.setState({ loading: false, msg: res })})
}
render() {
From b56f4ba646bf332de1b6d12f10cd347fc5aa711b Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:19:13 +0900
Subject: [PATCH 32/50] sdfasdfasf
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index cc97080..b324f67 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -17,6 +17,6 @@ export async function handler (event, context) {
})
}
return {
- status: 200,
+ statusCode: 200,
body : {msg: data()}
}
From b58577bc25dec5a913989ee302f645810de99355 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:30:21 +0900
Subject: [PATCH 33/50] eroqeruq
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index b324f67..88c0661 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -18,5 +18,5 @@ export async function handler (event, context) {
}
return {
statusCode: 200,
- body : {msg: data()}
+ body : JSON.stringify({msg: data()})
}
From 3efe88df579845dff3853a3ef85ccf3891da9a55 Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:32:51 +0900
Subject: [PATCH 34/50] fasdfas
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 5748422..613e111 100644
--- a/src/App.js
+++ b/src/App.js
@@ -19,7 +19,7 @@ class LambdaDemo extends Component {
if (err) {
return
}
- this.setState({ loading: false, msg: res })})
+ this.setState({ loading: false, msg: res.text })})
}
render() {
From 6a67fc30703ab2baf2939508f33628a13fc75e0b Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:36:58 +0900
Subject: [PATCH 35/50] dsfsfa
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 613e111..e9d1af0 100644
--- a/src/App.js
+++ b/src/App.js
@@ -19,7 +19,7 @@ class LambdaDemo extends Component {
if (err) {
return
}
- this.setState({ loading: false, msg: res.text })})
+ this.setState({ loading: false, msg: res.text[0] })})
}
render() {
From ce9b9a53927b9ffbf34cfd35a572962877b528ae Mon Sep 17 00:00:00 2001
From: n18011
Date: Sun, 13 Oct 2019 17:42:29 +0900
Subject: [PATCH 36/50] fasdfasfafa
---
src/App.js | 2 +-
src/lambda/async-dadjoke.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/App.js b/src/App.js
index e9d1af0..bd13a58 100644
--- a/src/App.js
+++ b/src/App.js
@@ -19,7 +19,7 @@ class LambdaDemo extends Component {
if (err) {
return
}
- this.setState({ loading: false, msg: res.text[0] })})
+ this.setState({ loading: false, msg: JSON.stringify(res.text) })})
}
render() {
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 88c0661..b324f67 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -18,5 +18,5 @@ export async function handler (event, context) {
}
return {
statusCode: 200,
- body : JSON.stringify({msg: data()})
+ body : {msg: data()}
}
From 88aef023c27e641d9a393ba844068bf9fbd9ea5b Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 09:48:50 +0900
Subject: [PATCH 37/50] 10/15 a
---
src/App.js | 2 +-
src/lambda/async-dadjoke.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/App.js b/src/App.js
index bd13a58..5748422 100644
--- a/src/App.js
+++ b/src/App.js
@@ -19,7 +19,7 @@ class LambdaDemo extends Component {
if (err) {
return
}
- this.setState({ loading: false, msg: JSON.stringify(res.text) })})
+ this.setState({ loading: false, msg: res })})
}
render() {
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index b324f67..88c0661 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -18,5 +18,5 @@ export async function handler (event, context) {
}
return {
statusCode: 200,
- body : {msg: data()}
+ body : JSON.stringify({msg: data()})
}
From 0f7d69bfa30aad6840705c9469b0f178f2b7ee9a Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 09:55:42 +0900
Subject: [PATCH 38/50] 10/15 b
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index 5748422..be53db6 100644
--- a/src/App.js
+++ b/src/App.js
@@ -19,7 +19,7 @@ class LambdaDemo extends Component {
if (err) {
return
}
- this.setState({ loading: false, msg: res })})
+ this.setState({ loading: false, msg: res.msg })})
}
render() {
From d8f294c0c8d57a597bd74ee363c600c41e956504 Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 09:59:42 +0900
Subject: [PATCH 39/50] 10/15 c
---
src/App.js | 11 ++++-------
src/lambda/async-dadjoke.js | 15 ++++++++-------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/App.js b/src/App.js
index be53db6..99577dc 100644
--- a/src/App.js
+++ b/src/App.js
@@ -13,13 +13,10 @@ class LambdaDemo extends Component {
e.preventDefault()
this.setState({ loading: true })
- request.get("/.netlify/functions/" + api)
- .accept('application/json')
- .end((err, res) => {
- if (err) {
- return
- }
- this.setState({ loading: false, msg: res.msg })})
+
+ fetch("/.netlify/functions/" + api)
+ .then(response => response.json())
+ .then(json => this.setState({ loading: false, msg: json.msg }))
}
render() {
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 88c0661..43b81eb 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -9,14 +9,15 @@ const client = challonge.createClient({
export async function handler (event, context) {
const data = () => {
client.tournaments.show({
- id: 'n18011',
- callback: (err, data) => {
- console.log(err, data)
- return data
- }
- })
+ id: 'n18011',
+ callback: (err, data) => {
+ console.log(err, data)
+ return data
+ }
+ })
}
return {
statusCode: 200,
- body : JSON.stringify({msg: data()})
+ body: JSON.stringify({ msg: data() })
+ }
}
From 7299a34d219044b67fe1d0359d299d02ae268cb7 Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 10:01:55 +0900
Subject: [PATCH 40/50] 10/15 d
---
src/App.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/App.js b/src/App.js
index 99577dc..aa9bd77 100644
--- a/src/App.js
+++ b/src/App.js
@@ -14,9 +14,14 @@ class LambdaDemo extends Component {
this.setState({ loading: true })
- fetch("/.netlify/functions/" + api)
- .then(response => response.json())
- .then(json => this.setState({ loading: false, msg: json.msg }))
+
+ request.get("/.netlify/functions/" + api)
+ .accept('application/json')
+ .end((err, res) => {
+ if (err) {
+ return
+ }
+ this.setState({ loading: false, msg: res.msg })})
}
render() {
From 583e175342c081816af6173c34121ebb7b0f40cc Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 10:04:29 +0900
Subject: [PATCH 41/50] 10/15 f
---
src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/App.js b/src/App.js
index aa9bd77..307900c 100644
--- a/src/App.js
+++ b/src/App.js
@@ -21,7 +21,7 @@ class LambdaDemo extends Component {
if (err) {
return
}
- this.setState({ loading: false, msg: res.msg })})
+ this.setState({ loading: false, msg: res })})
}
render() {
From da81b0172ece4b8d33026d1268d4ed268cbac89e Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 10:11:43 +0900
Subject: [PATCH 42/50] 10/15 g
---
src/lambda/async-dadjoke.js | 31 ++++++++++++++++++++-----------
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 43b81eb..6c99f3c 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -2,22 +2,31 @@
// https://github.com/netlify/netlify-lambda/issues/43#issuecomment-444618311
const challonge = require('challonge')
+const request = require('superagent')
const client = challonge.createClient({
apiKey: 'THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU'
})
-export async function handler (event, context) {
+/*
+const data = () => {
+ request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
+ .end((err, res) => {
+ console.log(res)
+ })
+}
+*/
+
+export async function handler (event, context, callback) {
+ /*
const data = () => {
- client.tournaments.show({
- id: 'n18011',
- callback: (err, data) => {
- console.log(err, data)
- return data
- }
- })
+ request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
+ .end((err, res) => {
+ console.log(res)
+ })
}
- return {
+ */
+ callback(null, {
statusCode: 200,
- body: JSON.stringify({ msg: data() })
- }
+ body: JSON.stringify({ msg: 'Hello, World!' })
+ })
}
From 174ca3aec985e002427107c2961ac7bf4fb4171a Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 10:16:47 +0900
Subject: [PATCH 43/50] 10/15 h
---
src/lambda/async-dadjoke.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 6c99f3c..e869a77 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -17,16 +17,14 @@ const data = () => {
*/
export async function handler (event, context, callback) {
- /*
const data = () => {
request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
.end((err, res) => {
console.log(res)
})
}
- */
callback(null, {
statusCode: 200,
- body: JSON.stringify({ msg: 'Hello, World!' })
+ body: JSON.stringify({ msg: await data() })
})
}
From bf7d89d423f643f53ea0de3f6f362d36fb828ff9 Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 10:21:54 +0900
Subject: [PATCH 44/50] 10/15 i
---
src/lambda/async-dadjoke.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index e869a77..0e65169 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -20,7 +20,7 @@ export async function handler (event, context, callback) {
const data = () => {
request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
.end((err, res) => {
- console.log(res)
+ return res
})
}
callback(null, {
From 9efd7878e0ba6a81be34f0b9087254e6bb112383 Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 11:07:04 +0900
Subject: [PATCH 45/50] asdfas
---
src/lambda/async-dadjoke.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 0e65169..04090be 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -16,11 +16,18 @@ const data = () => {
}
*/
+/*
+request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
+ .end((err, res) => {
+ console.log(res.body)
+ })
+*/
+
export async function handler (event, context, callback) {
const data = () => {
request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
.end((err, res) => {
- return res
+ return res.body
})
}
callback(null, {
From 668894e68a889cf596f5969e43843fb2c0ee8c2e Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 12:18:50 +0900
Subject: [PATCH 46/50] asdfasdf
---
src/lambda/async-dadjoke.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index 04090be..a60e8a4 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -30,8 +30,8 @@ export async function handler (event, context, callback) {
return res.body
})
}
- callback(null, {
+ await callback(null, {
statusCode: 200,
- body: JSON.stringify({ msg: await data() })
+ body: JSON.stringify({ msg: data() })
})
}
From 509013822d5c89b06127b1eab68a76071c767292 Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 13:59:48 +0900
Subject: [PATCH 47/50] add auth key
---
src/lambda/async-dadjoke.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index a60e8a4..da4555a 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -26,6 +26,7 @@ request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challon
export async function handler (event, context, callback) {
const data = () => {
request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
+ .set('Authorization', '8a9553be6113a4effad5159d64d27a14d8d1970e8853080e5de1dae1177668e9')
.end((err, res) => {
return res.body
})
From f71bbd325485d61ea227911a461e0a954303793e Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 14:02:43 +0900
Subject: [PATCH 48/50] add App.js auth key
---
src/App.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/App.js b/src/App.js
index 307900c..afb6c85 100644
--- a/src/App.js
+++ b/src/App.js
@@ -17,6 +17,7 @@ class LambdaDemo extends Component {
request.get("/.netlify/functions/" + api)
.accept('application/json')
+ .set('Authorization', '8a9553be6113a4effad5159d64d27a14d8d1970e8853080e5de1dae1177668e9')
.end((err, res) => {
if (err) {
return
From ed28dfadce24eb43688a5ead454b31ef93679a2f Mon Sep 17 00:00:00 2001
From: n18011
Date: Tue, 15 Oct 2019 14:05:27 +0900
Subject: [PATCH 49/50] only auth key in App
---
src/lambda/async-dadjoke.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/lambda/async-dadjoke.js b/src/lambda/async-dadjoke.js
index da4555a..a60e8a4 100644
--- a/src/lambda/async-dadjoke.js
+++ b/src/lambda/async-dadjoke.js
@@ -26,7 +26,6 @@ request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challon
export async function handler (event, context, callback) {
const data = () => {
request.get('https://n18011:THQwE1NobDxeWTRbAb8ACEtrUV4jDse7C6N7PwvU@api.challonge.com/v1/tournaments.json')
- .set('Authorization', '8a9553be6113a4effad5159d64d27a14d8d1970e8853080e5de1dae1177668e9')
.end((err, res) => {
return res.body
})
From d1475ec660bdbcdcd3d93497e9ea4a8bbda29453 Mon Sep 17 00:00:00 2001
From: n18011 <39284975+n18011@users.noreply.github.com>
Date: Tue, 15 Oct 2019 14:40:36 +0900
Subject: [PATCH 50/50] Delete App.js
---
src/App.js | 60 ------------------------------------------------------
1 file changed, 60 deletions(-)
delete mode 100644 src/App.js
diff --git a/src/App.js b/src/App.js
deleted file mode 100644
index afb6c85..0000000
--- a/src/App.js
+++ /dev/null
@@ -1,60 +0,0 @@
-import React, { Component } from "react"
-import logo from "./logo.svg"
-import "./App.css"
-import request from 'superagent'
-
-class LambdaDemo extends Component {
- constructor(props) {
- super(props)
- this.state = { loading: false, msg: null }
- }
-
- handleClick = api => e => {
- e.preventDefault()
-
- this.setState({ loading: true })
-
-
- request.get("/.netlify/functions/" + api)
- .accept('application/json')
- .set('Authorization', '8a9553be6113a4effad5159d64d27a14d8d1970e8853080e5de1dae1177668e9')
- .end((err, res) => {
- if (err) {
- return
- }
- this.setState({ loading: false, msg: res })})
- }
-
- render() {
- const { loading, msg } = this.state
- console.log(msg)
-
- return (
-
-
-
-
-
-
hello!
-
- )
- }
-}
-
-class App extends Component {
- render() {
- return (
-
- )
- }
-}
-
-export default App