Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal invocation at Booru.search #35

Closed
HenriqueJoaoMds opened this issue Aug 12, 2019 · 1 comment
Closed

Illegal invocation at Booru.search #35

HenriqueJoaoMds opened this issue Aug 12, 2019 · 1 comment
Assignees
Labels

Comments

@HenriqueJoaoMds
Copy link

HenriqueJoaoMds commented Aug 12, 2019

i'm trying to do a frontend with react using booru, but every time i try to make the search, it gives the error:

Constants.js:24 Uncaught (in promise) BooruError: Failed to execute 'fetch' on 'Window': Illegal invocation at Booru.search (http://localhost:3000/static/js/0.chunk.js:543:13)

there is the code, sorry for some words being in portuguese:

import React from "react";
import { search } from "booru";
import "./Main.css";

export default function Main() {
  let tmpTags;
  let tags;
  let listOfLinks;
  let posts;

  async function handleSubmit() {
    tags = tmpTags.split();
    console.log(tags);
    listOfLinks = [];
    posts = await search("rule34", tags, {
      limit: 1,
      random: true
    });
    console.log(posts)
    for (let post of posts) {
      await listOfLinks.push(String(post.fileUrl));
    }
    console.log(tags);
  }

  return (
    <div className="main-container">
      <h1 className="titulo">Booru Pack Downloader</h1>
      <input
        className="barra-de-pesquisa"
        value={tmpTags}
        placeholder="Quais tags você quer pesquisar?"
        onChange={e => (tmpTags = e.target.value)}
      />
      <button className="botão-de-pesquisa" onClick={handleSubmit}>
        pesquisar
      </button>
    </div>
  );
}
AtoraSuunva pushed a commit that referenced this issue Aug 15, 2019
@AtoraSuunva
Copy link
Owner

Seems to be an issue related to how webpack bundles code up (see developit/unfetch#46 and orbitjs/orbit#452)

booru isn't officially supported on browsers, but I've put out a (possible) fix at https://github.com/AtlasTheBot/booru/tree/fix/%2335-illegal-invocation

Try using that and see if it's fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants