Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/0.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
steffans committed Jan 13, 2016
2 parents ed85a38 + d624b71 commit b675df9
Show file tree
Hide file tree
Showing 9 changed files with 207 additions and 199 deletions.
40 changes: 17 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The plugin provides services for making web requests and handle responses using

Add `vue` and `vue-resource` to your `package.json`, then `npm install`, then add these lines in your code:

```javascript
```js
var Vue = require('vue');

Vue.use(require('vue-resource'));
Expand All @@ -20,14 +20,14 @@ Vue.use(require('vue-resource'));

Set default values using the global configuration.

```javascript
```js
Vue.http.options.root = '/root';
Vue.http.headers.common['Authorization'] = 'Basic YXBpOnBhc3N3b3Jk';
```

Set default values inside your Vue component options.

```javascript
```js
new Vue({

http: {
Expand Down Expand Up @@ -70,7 +70,7 @@ The http service can be used globally `Vue.http` or in a Vue instance `this.$htt

### Example

```javascript
```js
new Vue({

ready: function() {
Expand Down Expand Up @@ -110,7 +110,7 @@ The resource service can be used globally `Vue.resource` or in a Vue instance `t

### Default Actions

```javascript
```js
get: {method: 'GET'},
save: {method: 'POST'},
query: {method: 'GET'},
Expand All @@ -120,7 +120,7 @@ delete: {method: 'DELETE'}
```

### Example
```javascript
```js
new Vue({

ready: function() {
Expand Down Expand Up @@ -155,7 +155,7 @@ new Vue({

Interceptors can be defined globally and are used for pre- and postprocessing of a request.

```javascript
```js
Vue.http.interceptors.push({

request: function (request) {
Expand All @@ -169,26 +169,20 @@ Vue.http.interceptors.push({
});
```

#### Interceptor Factory
A factory function can also be used.

If Promises are needed inside of a Interceptor, a factory function can be used.

```javascript
Vue.http.interceptors.push(function (Promise) {
```js
Vue.http.interceptors.push(function () {
return {

request: function (request) {
if (reject) {
return Promise.reject();
}
},
request: function (request) {
return request;
},

response: function (response) {
if (reject) {
return Promise.reject();
}
}
response: function (response) {
return response;
}

};
};
});
```
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vue-resource",
"main": "dist/vue-resource.js",
"description": "A web request service for Vue.js",
"version": "0.6.0",
"version": "0.6.1",
"homepage": "https://github.com/vuejs/vue-resource",
"license": "MIT",
"ignore": [
Expand Down
Loading

0 comments on commit b675df9

Please sign in to comment.