Skip to content

Commit

Permalink
feat: local api url
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxy0551 committed Jul 26, 2023
1 parent 1aeefb8 commit 747823c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pages/article/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ const Article = (data) => {
]
const {title, description, keywords} = seo || {};
const sortTag = tagList?.find(item => item.key === tag_type)?.label;
const env = process.env.NODE_ENV || 'development';
const fetchUrl = env === 'development' ? 'http://localhost:3002' : '';

useEffect(() => {
setMobile(isMobile(window));
fetch('/api/getTagList')
fetch(`${fetchUrl}/api/getTagList`)
.then(res => res.json())
.then(res => {
const tagList = res.data?.map((item) => {
Expand Down Expand Up @@ -75,7 +77,7 @@ const Article = (data) => {
sort_type,
}
setSpinning(true)
fetch(`/api/getArticleList?${new URLSearchParams(params).toString()}`)
fetch(`${fetchUrl}/api/getArticleList?${new URLSearchParams(params).toString()}`)
.then(res => res.json())
.then(res => {
handleArticleList(res.data)
Expand Down

0 comments on commit 747823c

Please sign in to comment.