Skip to content

Commit

Permalink
feat: config server url in file
Browse files Browse the repository at this point in the history
  • Loading branch information
wfnuser committed Jul 15, 2024
1 parent 0eb0456 commit 0fa07e8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/constants/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const backendUrl = 'localhost:5050'
6 changes: 2 additions & 4 deletions src/pages/callback/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { backendUrl } from '@/constants/config'
import React, { useEffect } from 'react'
import { useLocation } from 'react-router-dom'

Expand All @@ -8,7 +9,7 @@ const Callback = () => {
const code = searchParams.get('code')

if (code) {
fetch(`http://183.131.108.116:3000/auth/github?code=${code}`)
fetch(`http://${backendUrl}/auth/github?code=${code}`)
.then((response) => response.json())
.then((data) => {
console.log('User info:', data)
Expand All @@ -18,9 +19,6 @@ const Callback = () => {
console.error('Error fetching user info:', error)
})
}
// setTimeout(() => {
// window.location.href = '/'
// }, 5000) // 5000 毫秒即 5 秒
})

return (
Expand Down

0 comments on commit 0fa07e8

Please sign in to comment.