diff --git a/src/constants/config.ts b/src/constants/config.ts new file mode 100644 index 0000000..7ad55c8 --- /dev/null +++ b/src/constants/config.ts @@ -0,0 +1 @@ +export const backendUrl = '124.221.119.233:5050' diff --git a/src/pages/callback/index.tsx b/src/pages/callback/index.tsx index 4656514..50c3534 100644 --- a/src/pages/callback/index.tsx +++ b/src/pages/callback/index.tsx @@ -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 = () => { @@ -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) @@ -18,9 +19,6 @@ const Callback = () => { console.error('Error fetching user info:', error) }) } - // setTimeout(() => { - // window.location.href = '/' - // }, 5000) // 5000 毫秒即 5 秒 }) return (