import Vue from 'vue' import store from '@/store' export default function switchCategory (payload = {}, option) { return new Promise(async (resolve, reject) => { const { id } = payload const role = store.state.user.role const requestBody = { id, } try { const url = role === 'shop' ? '/product/product/up_status' : '/product/operate/product/sale_status' await Vue.http.put(url, requestBody) resolve() } catch (e) { reject(e) } }) }