fix addition link to input
This commit is contained in:
parent
541545b166
commit
cd88541981
@ -1,4 +1,3 @@
|
|||||||
import logo from './logo.svg';
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
import {BrowserRouter, Routes, Route} from "react-router-dom";
|
import {BrowserRouter, Routes, Route} from "react-router-dom";
|
||||||
|
@ -22,17 +22,14 @@ class AddLink extends Component {
|
|||||||
if (this.state.value === "") {
|
if (this.state.value === "") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const linkName = this.createLink(this.state.value)
|
var linkName = makeid(6)
|
||||||
console.log(linkName)
|
this.createLink(this.state.value, linkName)
|
||||||
this.setState({value: `https://timka.su/${linkName}`})
|
this.setState({value: `https://timka.su/${linkName}`})
|
||||||
}
|
}
|
||||||
|
|
||||||
createLink(url) {
|
createLink(url, linkName) {
|
||||||
axios.post("https://link.timka.su",
|
return axios.post("https://link.timka.su",
|
||||||
{name: makeid(6), url: url}).then(function (response) {
|
{name: linkName, url: url})
|
||||||
console.log(response.data.name)
|
|
||||||
return `${response.data.name}`
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
|
@ -4,6 +4,7 @@ import {React, Component} from "react";
|
|||||||
class NotFound extends Component {
|
class NotFound extends Component {
|
||||||
render () {
|
render () {
|
||||||
return <h2>Not found</h2>
|
return <h2>Not found</h2>
|
||||||
|
// todo add design
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user