Prechádzať zdrojové kódy

[FIX] json type in customer resource caller and method names normalization

Gogs 7 rokov pred
rodič
commit
58b697fdbf
3 zmenil súbory, kde vykonal 18 pridanie a 6 odobranie
  1. 1 1
      controllers/main.py
  2. 12 0
      src/constants/actionTypes.js
  3. 5 5
      src/store/actions.js

+ 1 - 1
controllers/main.py

@@ -201,7 +201,7 @@ class Sales(http.Controller):
     '''
         Create customer and return data
     '''
-    @http.route('/eiru_sales/create_customer', auth='user', methods=['POST'], cors='*')
+    @http.route('/eiru_sales/create_customer', type='json', auth='user', methods=['POST'], cors='*')
     def create_customer(self, **kw):
         self.make_info_log('Creating customer')
 

+ 12 - 0
src/constants/actionTypes.js

@@ -1,3 +1,11 @@
+const NOTIFY = 'notify'
+
+const INIT_SALE = 'initSale'
+
+const EXPLODE_DATA = 'explodeData'
+
+const CREATE_SALE = 'createSale'
+
 const INIT_USER = 'initUser'
 
 const INIT_PRODUCTS = 'initProducts'
@@ -29,6 +37,10 @@ const ADD_TO_CART = 'addToCart'
 const CHANGE_CART_TOTAL = 'changeCartTotal'
 
 export {
+    NOTIFY,
+    INIT_SALE,
+    EXPLODE_DATA,
+    CREATE_SALE,
     INIT_USER,
     INIT_PRODUCTS,
     SELECT_PRODUCT,

+ 5 - 5
src/store/actions.js

@@ -1,6 +1,6 @@
 import axios from 'axios'
 import { INIT_SALE_URL, CREATE_CUSTOMER_URL, PROCESS_SALE_URL } from '@/constants/resourcePaths'
-import { CREATE_CUSTOMER } from '@/constants/actionTypes'
+import { INIT_SALE, NOTIFY, EXPLODE_DATA, CREATE_CUSTOMER, CREATE_SALE } from '@/constants/actionTypes'
 
 const actions = {
     /**
@@ -8,7 +8,7 @@ const actions = {
      * @param {*} param0 
      * @param {*} payload 
      */
-    notify({ commit }, payload) {
+    [NOTIFY] ({ commit }, payload) {
         openerp.web.notification.do_warn('Atención', payload)
         return false
     },
@@ -16,7 +16,7 @@ const actions = {
      * 
      * @param {*} param0 
      */
-    initSale({ dispatch }) {
+    [INIT_SALE] ({ dispatch }) {
         return axios.get(INIT_SALE_URL).then(response => {
             dispatch('explodeData', response.data)
         }).catch(error => {
@@ -28,7 +28,7 @@ const actions = {
      * @param {*} param0 
      * @param {*} payload 
      */
-    explodeData({ dispatch }, payload) {
+    [EXPLODE_DATA] ({ dispatch }, payload) {
         for (let value in payload) {
             dispatch(`init${value[0].toUpperCase()}${value.slice(1)}`, payload[value])
         }
@@ -52,7 +52,7 @@ const actions = {
      * 
      * @param {*} param0 
      */
-    createSale({ getters , dispatch }) {
+    [CREATE_SALE] ({ getters , dispatch }) {
 
     }
 }