|
|
@ -15,9 +15,9 @@ async function tweet (encodedImage) {
|
|
|
|
const processedData = encodedImage.split(',')[1]
|
|
|
|
const processedData = encodedImage.split(',')[1]
|
|
|
|
|
|
|
|
|
|
|
|
return axios.post(`${DOMAIN}/twitter`, { data: processedData })
|
|
|
|
return axios.post(`${DOMAIN}/twitter`, { data: processedData })
|
|
|
|
.then((res) => res.data.url)
|
|
|
|
.then(res => res.data.url)
|
|
|
|
.then((url) => encodeURIComponent(`Built with @carbon ${url}`))
|
|
|
|
.then(url => encodeURIComponent(`Built with #Carbon, by @dawn_labs ${url}`))
|
|
|
|
.then((uri) => `https://twitter.com/intent/tweet?text=${uri}`)
|
|
|
|
.then(uri => `https://twitter.com/intent/tweet?text=${uri}`)
|
|
|
|
.then(openTwitterUrl)
|
|
|
|
.then(openTwitterUrl)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -62,6 +62,6 @@ function openTwitterUrl (twitterUrl) {
|
|
|
|
const left = (window.outerWidth - width) / 2
|
|
|
|
const left = (window.outerWidth - width) / 2
|
|
|
|
const right = (window.outerHeight - height) / 2
|
|
|
|
const right = (window.outerHeight - height) / 2
|
|
|
|
const opts = `status=1,width=${width},height=${height},top=${top},left=${left}`
|
|
|
|
const opts = `status=1,width=${width},height=${height},top=${top},left=${left}`
|
|
|
|
|
|
|
|
|
|
|
|
window.open(twitterUrl, 'twitter', opts)
|
|
|
|
window.open(twitterUrl, 'twitter', opts)
|
|
|
|
}
|
|
|
|
}
|
|
|
|