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 {BrowserRouter, Routes, Route} from "react-router-dom";
|
||||
|
@ -22,17 +22,14 @@ class AddLink extends Component {
|
||||
if (this.state.value === "") {
|
||||
return
|
||||
}
|
||||
const linkName = this.createLink(this.state.value)
|
||||
console.log(linkName)
|
||||
var linkName = makeid(6)
|
||||
this.createLink(this.state.value, linkName)
|
||||
this.setState({value: `https://timka.su/${linkName}`})
|
||||
}
|
||||
|
||||
createLink(url) {
|
||||
axios.post("https://link.timka.su",
|
||||
{name: makeid(6), url: url}).then(function (response) {
|
||||
console.log(response.data.name)
|
||||
return `${response.data.name}`
|
||||
})
|
||||
createLink(url, linkName) {
|
||||
return axios.post("https://link.timka.su",
|
||||
{name: linkName, url: url})
|
||||
}
|
||||
|
||||
render () {
|
||||
@ -47,7 +44,7 @@ class AddLink extends Component {
|
||||
value={this.state.value}
|
||||
onChange={this.handleChange}
|
||||
autoComplete="off"
|
||||
required/>
|
||||
required />
|
||||
<br/>
|
||||
<button onClick={this.short} className="shortButton">Short!</button>
|
||||
</div>
|
||||
|
@ -4,6 +4,7 @@ import {React, Component} from "react";
|
||||
class NotFound extends Component {
|
||||
render () {
|
||||
return <h2>Not found</h2>
|
||||
// todo add design
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user