@@ -12,7 +12,6 @@ import uniqolor from 'uniqolor'
12
12
import { LazyLoad } from '~/components/common/Lazyload'
13
13
import { MingcuteStarHalfFill } from '~/components/icons/star'
14
14
import { usePeek } from '~/components/modules/peek/usePeek'
15
- import { API_URL } from '~/constants/env'
16
15
import { LanguageToColorMap } from '~/constants/language'
17
16
import { useIsClientTransition } from '~/hooks/common/use-is-client'
18
17
import useIsCommandOrControlPressed from '~/hooks/common/use-is-command-or-control-pressed'
@@ -526,7 +525,7 @@ const fetchLeetCodeQuestionData: FetchObject = {
526
525
query : `query questionData($titleSlug: String!) {\n question(titleSlug: $titleSlug) {translatedTitle\n difficulty\n likes\n topicTags { translatedName\n }\n stats\n }\n}\n` ,
527
526
variables : { titleSlug : id } ,
528
527
}
529
- const questionData = await fetch ( `${ API_URL } /fn /leetcode/shiro ` , {
528
+ const questionData = await fetch ( `/api /leetcode` , {
530
529
method : 'POST' ,
531
530
headers : {
532
531
'Content-Type' : 'application/json' ,
@@ -588,38 +587,31 @@ const fetchLeetCodeQuestionData: FetchObject = {
588
587
console . error ( 'Error fetching LeetCode question data:' , err )
589
588
throw err
590
589
}
591
- } ,
592
- }
593
-
594
- // 映射难度到颜色的函数
595
- function getDifficultyColor ( difficulty : string ) {
596
- switch ( difficulty ) {
597
- case 'Easy' :
598
- return '#00BFA5'
599
- case 'Medium' :
600
- return '#FFA726'
601
- case 'Hard' :
602
- return '#F44336'
603
- default :
604
- return '#757575'
605
- }
606
- }
607
590
608
- // 难度字体颜色className
609
- function getDifficultyColorClass ( difficulty : string ) {
610
- switch ( difficulty ) {
611
- case 'Easy' :
612
- return 'text-green-500'
613
- case 'Medium' :
614
- return 'text-yellow-500'
615
- case 'Hard' :
616
- return 'text-red-500'
617
- default :
618
- return 'text-gray-500'
619
- }
620
- }
591
+ function getDifficultyColor ( difficulty : string ) {
592
+ switch ( difficulty ) {
593
+ case 'Easy' :
594
+ return '#00BFA5'
595
+ case 'Medium' :
596
+ return '#FFA726'
597
+ case 'Hard' :
598
+ return '#F44336'
599
+ default :
600
+ return '#757575'
601
+ }
602
+ }
621
603
622
- interface LeetCodeResponse {
623
- query : string
624
- variables : Record < string , any >
604
+ function getDifficultyColorClass ( difficulty : string ) {
605
+ switch ( difficulty ) {
606
+ case 'Easy' :
607
+ return 'text-green-500'
608
+ case 'Medium' :
609
+ return 'text-yellow-500'
610
+ case 'Hard' :
611
+ return 'text-red-500'
612
+ default :
613
+ return 'text-gray-500'
614
+ }
615
+ }
616
+ } ,
625
617
}
0 commit comments