<commit_before><commit_msg>added poll container for single poll<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';

import api from './../utils/api';

import NotFound from './../components/NotFound';

class PollContainer extends Component {

    constructor(props) {
        super(props);
        this.state = {
            poll: [],
            fetched: false,
            isError: false,
        }
    }

    componentDidMount() {
        this.getPoll();
    }

    getPoll() {
        let questionId = this.props.match.params.questionId;
        api.fetchSinglePoll(questionId)
            .then((poll) => {
                if (poll === 404){
                    this.setState({
                        fetched: true,
                        isError: true,
                    });
                }
                else{
                    this.setState({
                        fetched: true,
                        poll,
                    });
                }
            });
    }

    render() {
        return (
            !this.state.fetched
            ?(
                <div className="ui active inverted dimmer">
                    <div className="ui text loader">Loading the poll...</div>
                </div>
            )
            :(
                !this.state.isError
                ?(
                    <div>
                        Stoped here!!!
                    </div>
                )
                :(
                    <NotFound/>
                )
            )
        );
    }
}

PollContainer.propTypes = {
    className: PropTypes.string,
};

export default PollContainer;

{'fraction_non_alphanumeric': 0.10684273709483794, 'fraction_numerical': 0.001800720288115246, 'mean_word_length': 0.9798099762470309, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5521445', 'n_tokens_mistral': 424, 'n_tokens_neox': 393, 'n_words': 82}