import React from 'react';
import Error from './Err';
import { TitleInput, PasteInput } from './Inputs';
import PasteInfo from './PasteInfo';
import PasswordModal from './modals/PasswordModal'
import { FetchPaste, FetchPasswordPaste } from '../helpers/httpHelper'
const RENDER_MODES = Object.freeze({
RAW: 'raw text',
MD: 'markdown',
LATEX: 'latex',
CODE: 'code',
})
class ViewPaste extends React.Component {
constructor(props) {
super(props);
this.state = {
title: 'untitled paste',
content: '',
hasPass: false,
enteredPass: '',
validPass: false,
expiry: 'no expiry',
error: '',
passError: '',
mode: RENDER_MODES.RAW,
};
this.handleChange = this.handleChange.bind(this);
this.validatePass = this.validatePass.bind(this);
this.ErrorLabel = React.createRef();
this.PasswordModal = React.createRef();
}
handleChange(event) {
this.setState({ enteredPass: event.target.value });
}
drawRightMode() {
switch (this.state.mode) {
// TODO: add other renderers
// default render raw
case RENDER_MODES.RAW:
default:
return (