How to use the api.post function in api

To help you get started, we’ve selected a few api examples, based on popular ways it is used in public projects.

github omohokcoj / motor-admin / ui / src / settings / components / actions_list.vue View on Github external
onActionMove () {
      return api.post('configs', {
        data: {
          key: `resources.${this.resource.name}.actions.order`,
          value: this.resource.actions.map((action) => action.name)
        }
      }).then((result) => {
      }).catch((error) => {
        console.error(error)
      })
    }
  }
github omohokcoj / motor-admin / ui / src / settings / components / resource_action.vue View on Github external
removeRequest () {
      return api.post('resources', {
        data: {
          name: this.resource.name,
          preferences: {
            actions: [
              {
                name: this.action.name,
                _remove: true
              }
            ]
          }
        }
      }).then((result) => {
      }).catch((error) => {
        console.error(error)
      })
    },
github raindropio / extensions / src / stores / bookmark.jsx View on Github external
return new Promise((res,rej)=>{
			item.collectionId = -1;

			/*if (!tryAgain){
				try{item.collectionId = UserStore.getUser().config.last_collection}catch(e){}
				if (item.collectionId == -99)
					item.collectionId = -1;
			}*/

			Api.post("raindrop", item, (json)=>{
				if (!json.result){
					if (!tryAgain)
						return res(this.insertBookmark(item, true));

					if (json.auth===false)
						return rej("login_needLogin")

					return rej("cant_insert_bookmark")
				}

				res(json.item||{})
			})
		})
	},
github instrumentisto / vue-app-example / src / api / users.ts View on Github external
}).then((response: AxiosResponse) => {
            const users = response.data;

            if (users.length > 0) {
                return Promise.reject(1);
            }

            return API.post('/users', user)
                .then((postResponse: AxiosResponse) => {
                    return postResponse.data;
                });
        });
    }
github omohokcoj / motor-admin / ui / src / dashboards / components / form.vue View on Github external
apiRequest () {
      const params = {
        data: this.dataBoard,
        include: 'tags'
      }

      if (this.board.id) {
        return api.put(`dashboards/${this.dataBoard.id}`, params)
      } else {
        return api.post('dashboards', params)
      }
    }
  },
github Automattic / woocommerce-services / client / apps / shipping-label / state / get-rates.js View on Github external
if ( ! saving ) {
				dispatch( {
					type: RATES_RETRIEVAL_COMPLETED,
				} );
				if ( 'rest_cookie_invalid_nonce' === error ) {
					dispatch( exitPrintingFlow( true ) );
				} else if ( error ) {
					setTimeout( () => reject( error ), 0 );
				} else {
					setTimeout( resolve, 0 );
				}
			}
		};

		setIsSaving( true );
		api.post( api.url.getLabelRates( orderId ), { origin, destination, packages } )
			.then( setSuccess )
			.catch( setError )
			.then( () => setIsSaving( false ) );
	} );
};