This commit is contained in:
@@ -100,15 +100,13 @@ export default {
|
|||||||
saveCategoryAttributes(categoryId, attrs) {
|
saveCategoryAttributes(categoryId, attrs) {
|
||||||
const token = uni.getStorageSync('token')
|
const token = uni.getStorageSync('token')
|
||||||
const role = uni.getStorageSync('role') || ''
|
const role = uni.getStorageSync('role') || ''
|
||||||
// 确保是数组格式
|
|
||||||
const payload = Array.isArray(attrs) ? attrs : [attrs]
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
url: `${import.meta.env.VITE_API_BASE_URL}/products/categories/${categoryId}/attributes`,
|
url: `${import.meta.env.VITE_API_BASE_URL}/products/categories/${categoryId}/attributes`,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: payload,
|
data: JSON.stringify(attrs),
|
||||||
header: {
|
header: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json;charset=utf-8',
|
||||||
'Authorization': token ? `Bearer ${token}` : '',
|
'Authorization': token ? `Bearer ${token}` : '',
|
||||||
'X-User-Role': role
|
'X-User-Role': role
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user