import React from 'react';
import { TitleInput, PasteInput } from './Inputs'
import OptionsContainer from './Options'
import { Redirect } from 'react-router-dom'
import Error from './Err'
import { PostNewPaste } from '../helpers/httpHelper'
class NewPaste extends React.Component {
constructor(props) {
super(props);
this.state = {
title: '',
content: '',
pass: '',
expiry: '',
hash: '',
error: '',
};
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
newErr(msg, duration = 5000) {
this.setState({ error: msg })
setTimeout(() => {
this.setState({ error: '' })
}, duration);
}
renderRedirect = () => {
if (this.state.hash !== '') {
const redirUrl = `/${this.state.hash}`
return