import React from "react"
import AniLink from "gatsby-plugin-transition-link/AniLink"
import { NotificationManager, NotificationContainer } from 'react-notifications'
import 'react-notifications/lib/notifications.css'
import Seo from "../components/seo"
import axios from "../axios"
import "../css/base.css"
import "../css/url.css"
const AddURLPage = () => {
const [url, setURL] = React.useState('')
const changeURLHandler = event => {
const value = event.target.value
setURL(value)
}
const addURL = async () => {
setURL('')
if (url === '') {
return NotificationManager.error('Empty')
}
try {
const res = await axios.post('/url', {
url: url,
})
const data = res.data
NotificationManager.success(data.url, 'Added')
} catch (err) {
let e = ''
if (err.response && err.response.data.message) {
e = err.response.data.message
} else {
e = err.toString()
}
NotificationManager.error(e)
}
}
return (
<>