store.ts 703 B

12345678910111213141516171819202122232425262728
  1. import {axios} from '../utils/request'
  2. import {STORE_MODULE} from './_prefix'
  3. // 创建商店
  4. export const createStore = payload => {
  5. console.log(payload)
  6. return axios.post(`${STORE_MODULE}/`, payload,
  7. {headers: {'Content-Type': 'application/json','token': localStorage.getItem('token')}})
  8. .then(res => {
  9. return res;
  10. })
  11. }
  12. // 获取全部商店
  13. export const getAllStore = () => {
  14. return axios.get(`${STORE_MODULE}/`, )
  15. .then(res => {
  16. return res;
  17. })
  18. }
  19. // 获取指定商店
  20. export const getStoreById = storeId => {
  21. return axios.get(`${STORE_MODULE}/${storeId}`)
  22. .then(res => {
  23. return res;
  24. })
  25. }