+ <>
Not found
- Page not found
-
- Sorry{" "}
-
- 😔
- {" "}
- we couldn’t find what you were looking for.
+
Page not found
+
+ Sorry we couldn’t find what you were looking for.
- {process.env.NODE_ENV === "development" ? (
- <>
-
- Try creating a page in src/pages/
.
-
- >
- ) : null}
-
- Go home.
+
+
+
-
+ >
)
}
diff --git a/src/pages/add.js b/src/pages/add.js
new file mode 100644
index 0000000..d2ae319
--- /dev/null
+++ b/src/pages/add.js
@@ -0,0 +1,81 @@
+import React from "react"
+import { Link } from "gatsby"
+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 (
+ <>
+