Skip to content

Commit e877c16

Browse files
committed
fix: fix wrong id bug
1 parent a86844c commit e877c16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

create/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const create = data => {
44
const path = require('path');
55
const chalk = require('chalk');
66
const pageData = {
7-
id: data.questionId,
7+
id: data.questionFrontendId || data.questionId,
88
name: data.questionTitle,
99
difficulty: data.difficulty,
1010
relatedTopics: data.topicTags.map(t => t.name).join(', '),
@@ -92,7 +92,7 @@ const getName = url => {
9292

9393
const queryAndCreate = name => {
9494
const axios = require('axios');
95-
const url = `https://leetcode.com/graphql?query=query%20getQuestionDetail($titleSlug:%20String!)%20%7B%0A%20%20question(titleSlug:%20$titleSlug)%20%7B%0A%20%20%20%20questionId%0A%20%20%20%20questionTitle%0A%20%20%20%20content%0A%20%20%20%20difficulty%0A%20%20%20%20stats%0A%20%20%20%20similarQuestions%0A%20%20%20%20topicTags%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A&operationName=getQuestionDetail&variables=%7B%22titleSlug%22:%22${name}%22%7D`;
95+
const url = `https://leetcode.com/graphql?query=query%20getQuestionDetail($titleSlug:%20String!)%20%7B%0A%20%20question(titleSlug:%20$titleSlug)%20%7B%0A%20%20%20%20questionId%0A%20%20%20%20questionFrontendId%0A%20%20%20%20questionTitle%0A%20%20%20%20content%0A%20%20%20%20difficulty%0A%20%20%20%20stats%0A%20%20%20%20similarQuestions%0A%20%20%20%20topicTags%20%7B%0A%20%20%20%20%20%20name%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A&operationName=getQuestionDetail&variables=%7B%22titleSlug%22:%22${name}%22%7D`;
9696

9797
axios.get(url).then(res => {
9898
create(res.data.data.question);

0 commit comments

Comments
 (0)