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 8ac7921
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 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 = '124.221.119.233:5050'
8 changes: 3 additions & 5 deletions src/pages/callback/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect } from 'react'
import { backendUrl } from '@/constants/config'
import { useEffect } from 'react'
import { useLocation } from 'react-router-dom'

const Callback = () => {
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/callback?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 8ac7921

Please sign in to comment.