mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
use goddamn axios
This commit is contained in:
parent
fb4a0c09bb
commit
52453f6b20
3 changed files with 32 additions and 2 deletions
|
|
@ -17,6 +17,7 @@
|
|||
"@next/mdx": "^9.3.6",
|
||||
"@segment/snippet": "^4.9.0",
|
||||
"airtable-plus": "^1.0.4",
|
||||
"axios": "^0.19.2",
|
||||
"isomorphic-unfetch": "^3.0.0",
|
||||
"lodash": "^4.17.15",
|
||||
"next": "^9.3.6",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import AirtablePlus from 'airtable-plus'
|
||||
import fetch from 'isomorphic-unfetch'
|
||||
import axios from 'axios'
|
||||
|
||||
/*const joinTable = new AirtablePlus({
|
||||
apiKey: process.env.AIRTABLE_API_KEY,
|
||||
|
|
@ -13,6 +14,7 @@ export default async (req, res) => {
|
|||
if (req.method === 'POST') {
|
||||
const data = req.body
|
||||
console.log(data)
|
||||
console.log(`name: ${data.name}`)
|
||||
console.log(`token: ${process.env.SLACK_BOT_TOKEN}`)
|
||||
console.log(`AIRTABLE: ${process.env.AIRTABLE_API_KEY}`)
|
||||
|
||||
|
|
@ -73,14 +75,20 @@ export default async (req, res) => {
|
|||
}
|
||||
]
|
||||
}
|
||||
fetch('https://slack.com/api/chat.postMessage', {
|
||||
/*fetch('https://slack.com/api/chat.postMessage', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${process.env.SLACK_BOT_TOKEN}`
|
||||
},
|
||||
body: JSON.stringify(postData)
|
||||
}).catch(err => console.error(err))
|
||||
}).catch(err => console.error(err))*/
|
||||
axios.post('https://slack.com/api/chat.postMessage', postData, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${process.env.SLACK_BOT_TOKEN}`
|
||||
},
|
||||
}).then(r => console.log(r)).catch(err => console.error(err))
|
||||
}
|
||||
}
|
||||
res.json({ status: 'success' })
|
||||
|
|
|
|||
21
yarn.lock
21
yarn.lock
|
|
@ -1772,6 +1772,13 @@ aws4@^1.8.0:
|
|||
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.9.1.tgz#7e33d8f7d449b3f673cd72deb9abdc552dbe528e"
|
||||
integrity sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==
|
||||
|
||||
axios@^0.19.2:
|
||||
version "0.19.2"
|
||||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27"
|
||||
integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==
|
||||
dependencies:
|
||||
follow-redirects "1.5.10"
|
||||
|
||||
babel-code-frame@^6.22.0:
|
||||
version "6.26.0"
|
||||
resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
|
||||
|
|
@ -2703,6 +2710,13 @@ dashdash@^1.12.0:
|
|||
dependencies:
|
||||
assert-plus "^1.0.0"
|
||||
|
||||
debug@=3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
|
||||
integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==
|
||||
dependencies:
|
||||
ms "2.0.0"
|
||||
|
||||
debug@^2.2.0, debug@^2.3.3:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
|
|
@ -3189,6 +3203,13 @@ flush-write-stream@^1.0.0:
|
|||
inherits "^2.0.3"
|
||||
readable-stream "^2.3.6"
|
||||
|
||||
follow-redirects@1.5.10:
|
||||
version "1.5.10"
|
||||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.5.10.tgz#7b7a9f9aea2fdff36786a94ff643ed07f4ff5e2a"
|
||||
integrity sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==
|
||||
dependencies:
|
||||
debug "=3.1.0"
|
||||
|
||||
for-in@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue