1
Some checks failed
CI / build (push) Has been cancelled

This commit is contained in:
jrhlh
2025-07-18 18:49:59 +08:00
parent 3eeebab4f8
commit bd1fc93771
30 changed files with 119 additions and 177 deletions

View File

@ -13,11 +13,11 @@ const errorMessage = ref('');
const register = () => {
router.push('/register');
};
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
// 登录功能
const login = async () => {
try {
const response = await axios.post('http://localhost:5000/auth/login', {
const response = await axios.post(`${apiUrl}/auth/login`, {
username: username.value,
password: password.value
}, {

View File

@ -4,7 +4,7 @@ import axios, { type AxiosError } from 'axios'
import { useRouter } from 'vue-router'
const router = useRouter()
const apiUrl = import.meta.env.VITE_API_BASE_URL // 动态获取API基础URL
const username = ref('')
const password = ref('')
const verificationCode = ref('')
@ -23,7 +23,7 @@ const sendVerificationCode = async () => {
}
try {
await axios.post('http://localhost:5000/captcha/email', {
await axios.post(`${apiUrl}/captcha/email`, {
email: username.value
})
@ -69,7 +69,7 @@ const register = async () => {
}
try {
const response = await axios.post('http://localhost:5000/register', {
const response = await axios.post(`${apiUrl}/register`, {
username: username.value,
password: password.value,
code: verificationCode.value