测试博客提交修正

This commit is contained in:
Guarp 2025-03-08 13:13:18 +08:00
parent 3d7553ca61
commit 85ae79b195

View File

@ -253,9 +253,9 @@ const submitBlog = async () => {
console.log(Object.fromEntries(formData.entries())); console.log(Object.fromEntries(formData.entries()));
// 3 // 3
const testAxiosAPI = api; const tempURL = api.defaults.baseURL;
testAxiosAPI.defaults.baseURL = submitURL; api.defaults.baseURL = submitURL;
testAxiosAPI.post('', formData).then(response => { api.post('', formData).then(response => {
if (response.code === 0) { if (response.code === 0) {
swal.window('success', '提交成功',`博客id: ${response.blogId || '未找到blogId字段'}`,'ok','好的'); swal.window('success', '提交成功',`博客id: ${response.blogId || '未找到blogId字段'}`,'ok','好的');
return; return;
@ -264,6 +264,7 @@ const submitBlog = async () => {
}).catch((e) => { }).catch((e) => {
swal.tip('error', `错误${e.message}`) swal.tip('error', `错误${e.message}`)
}); });
api.defaults.baseURL = tempURL;
// api.post('/blogs', formData).then(response => { // api.post('/blogs', formData).then(response => {
// if (response.status !== 200) { // if (response.status !== 200) {