diff --git a/src/constants/config.ts b/src/constants/config.ts new file mode 100644 index 0000000..0a2d3b4 --- /dev/null +++ b/src/constants/config.ts @@ -0,0 +1 @@ +export const backendUrl = 'localhost:5050' diff --git a/src/pages/callback/index.tsx b/src/pages/callback/index.tsx index 4656514..74880f6 100644 --- a/src/pages/callback/index.tsx +++ b/src/pages/callback/index.tsx @@ -1,3 +1,4 @@ +import { backendUrl } from '@/constants/config' import React, { useEffect } from 'react' import { useLocation } from 'react-router-dom' @@ -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) @@ -18,9 +19,6 @@ const Callback = () => { console.error('Error fetching user info:', error) }) } - // setTimeout(() => { - // window.location.href = '/' - // }, 5000) // 5000 毫秒即 5 秒 }) return (