save code
This commit is contained in:
+1
-1
@@ -1,5 +1,5 @@
|
||||
// API调用封装
|
||||
const API_BASE_URL = '/api';
|
||||
const API_BASE_URL = 'http://localhost:5000/api';
|
||||
|
||||
// 获取发型列表
|
||||
export async function getHairstyles() {
|
||||
|
||||
Vendored
+5
File diff suppressed because one or more lines are too long
+6
-3
@@ -1,7 +1,10 @@
|
||||
// API基础URL
|
||||
const API_BASE_URL = 'http://xiangsilian.com:5000/api';
|
||||
|
||||
// API调用函数
|
||||
async function getHairstyles() {
|
||||
try {
|
||||
const response = await axios.get('/api/hairstyles');
|
||||
const response = await axios.get(`${API_BASE_URL}/hairstyles`);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('获取发型列表失败:', error);
|
||||
@@ -15,7 +18,7 @@ async function changeHair(imageFile, hairstyleId) {
|
||||
formData.append('image', imageFile);
|
||||
formData.append('hairstyle_id', hairstyleId);
|
||||
|
||||
const response = await axios.post('/api/change-hair', formData, {
|
||||
const response = await axios.post(`${API_BASE_URL}/change-hair`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
@@ -34,7 +37,7 @@ async function changeHairColor(imageFile, rgb, ratio) {
|
||||
formData.append('rgb', rgb);
|
||||
formData.append('ratio', ratio);
|
||||
|
||||
const response = await axios.post('/api/change-hair-color', formData, {
|
||||
const response = await axios.post(`${API_BASE_URL}/change-hair-color`, formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user