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

Readme default code ReferenceError: XMLHttpRequest #13

Open
Jan-DaCuMa opened this issue Jul 29, 2024 · 2 comments
Open

Readme default code ReferenceError: XMLHttpRequest #13

Jan-DaCuMa opened this issue Jul 29, 2024 · 2 comments

Comments

@Jan-DaCuMa
Copy link

I have this in my page.tsx as you mentioned in the readme. I also did an npm i and npm i vttl-api.
This is the code I have

// pages/index.js
"use client";
import { provinces, getClubs } from 'vttl-api';

export default async function Home() {

for (let province of provinces) {
	let clubs = await getClubs({ ClubCategory: province.id });
  
}
  return <div>Haai</div>
}

When I go to this page, I see in the logs:
⨯ ReferenceError: XMLHttpRequest is not defined at new Promise (<anonymous>) at Home (./app/page.tsx:13:77) digest: "4248625284" GET / 500 in 632ms

Without the code of vttl-api, it works.

Can you take a look at it?
Kr.

@Jan-DaCuMa Jan-DaCuMa changed the title Read Readme default code ReferenceError: XMLHttpRequest Jul 29, 2024
@Jan-DaCuMa
Copy link
Author

Fyi, I use node v20

@subhero24
Copy link
Owner

subhero24 commented Jul 29, 2024

Running the package server side will not work as the official API is a SOAP XML api. The browser has a native XML parser, but node does not. So make sure getClubs runs on the client.

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

No branches or pull requests

2 participants