<commit_before>import React, { Component } from 'react'
import tagsInput from 'tags-input'
import fuzzysearch from 'fuzzysearch'

export default class ForumTagsSearch extends Component {
  constructor (props) {
    super(props)

    this.state = {
      showList: false,
      tags: [],
      allTags: [],
      tagsRetrieved: false,
      query: ''
    }
  }

  componentWillMount () {
    const { initialTags } = this.props
    window.fetch(`/api/v2/forums/${this.props.forum}/tags`)
      .then((res) => res.json())
      .then((res) => {
        let tags = (initialTags)
          ? res.results.tags.concat(
              initialTags.filter((t) => !~res.results.tags.indexOf(t))
            )
          : res.results.tags
        this.setState({ allTags: tags })
      })
      .catch((err) => { console.log(err) })
  }<commit_msg>update tags component with new api<commit_after>import React, { Component } from 'react'
import tagsInput from 'tags-input'
import fuzzysearch from 'fuzzysearch'

export default class ForumTagsSearch extends Component {
  constructor (props) {
    super(props)

    this.state = {
      showList: false,
      tags: [],
      allTags: [],
      tagsRetrieved: false,
      query: ''
    }
  }

  componentWillMount () {
    const { initialTags } = this.props
    window.fetch(`/api/v2/forums/${this.props.forum}/tags`)
      .then((res) => res.json())
      .then((res) => {
        let tags = res.results.tags.map(({ tag }) => tag)
        if (initialTags) {
          let initialUniqueTags = initialTags.filter((t) => !~tags.indexOf(t))
          tags = initialTags ? tags.concat(initialUniqueTags) : tags
        }
        this.setState({ allTags: tags })
      })
      .catch((err) => { console.log(err) })
  }
{'fraction_non_alphanumeric': 0.148, 'fraction_numerical': 0.001142857142857143, 'mean_word_length': 2.433333333333333, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '4667007', 'n_tokens_mistral': 545, 'n_tokens_neox': 533, 'n_words': 113}