@ -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
|
||||
}, {
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user