thisissteven / monkeytype-clone

A typeracer app based on monkeytype
https://mtype.vercel.app
66 stars 10 forks source link

the game is working but i am getting leaderboard error #5

Open View-my-Git-Lab-krafi opened 1 year ago

View-my-Git-Lab-krafi commented 1 year ago

Unhandled Runtime Error Error: An error occurred while fetching the data.

Source src/hooks/useLeaderboard.ts (39:12) @ _callee$

37 | }); 38 | if (!res.ok) {

39 | throw new Error('An error occurred while fetching the data.'); | ^ 40 | } 41 | return res.json(); 42 | }; Call Stack tryCatch node_modules/next/dist/compiled/regenerator-runtime/runtime.js (45:15) Generator.invoke [as _invoke] node_modules/next/dist/compiled/regenerator-runtime/runtime.js (274:0) prototype. [as next] node_modules/next/dist/compiled/regenerator-runtime/runtime.js (97:0) asyncGeneratorStep node_modules/@swc/helpers/src/_async_to_generator.mjs (3:0) _next node_modules/@swc/helpers/src/_async_to_generator.mjs (25:0)

View-my-Git-Lab-krafi commented 1 year ago

The project code is impressive, but it lacks documentation, which can make it difficult to figure out how to configure. To start the project, navigate to the /app directory and use the command 'yarn dev.' Next, open another terminal and go to the /socket directory. From there, use the commands 'npm install' and 'npm start.'

It's important to note that the socket expects to see the app running on port 3000, as specified in the code at /monkeytype-clone/socket/build/index.js. exports.io = new socket_io_1.Server(server, { cors: { origin: [ "http://localhost:3000", "https://mtype.vercel.app", "https://monkeytype-clone.vercel.app", "https://typez.vercel.app", ], methods: ["GET", "POST"], }, });

Additionally, the code at /monkeytype-clone/app/src/node_modules/next/dist/compiled/regenerator-runtime/runtime.js includes the line 'const API_URL = process.env.NEXT_PUBLIC_API_URL;' dont touch anything !

To configure the project, create a .env variable on the /app dir with the command 'nano .env'( i am using nano editor) and include the following line: 'NEXT_PUBLIC_API_URL=http://localhost:8080/graphql.'

Although the project code is impressive, it's crucial to have clear and comprehensive documentation to help users understand how to set it up and use it. I recommend updating the documentation to provide clear instructions on how to configure the project, including all dependencies and configurations required for successful operation.