Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 10, 2019. It is now read-only.

Commitf46743e

Browse files
committed
fixed bug on forms responses
1 parent8e83987 commitf46743e

File tree

5 files changed

+37
-16
lines changed

5 files changed

+37
-16
lines changed

‎release/angular-codey-ajaxinterceptor.js‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*@Authors: [Hitmands <gius.mand.developer@gmail.com>, Luca Pau <luca.pau82@gmail.com>]
44
*@Link: https://github.com/Code-Y/angular-ajax-interceptor
55
*@License: MIT
6-
*@Date: 2015-04-10
6+
*@Date: 2015-04-17
77
*@Version: 1.0.0
88
***/
99

@@ -86,7 +86,16 @@
8686
return_adaptResponse(response,resolve,reject,$log);
8787
},
8888
"responseError":functionAjaxInterceptorResponseErrorInterceptor(response){
89-
returnreject(response.config.adapt ?newErrorAjaxResponse(response) :response);
89+
if(!response.config.adapt){
90+
returnreject(response);
91+
}
92+
switch(response.config.adapt){
93+
case"form":
94+
returnreject(newFormAjaxResponse(response,!0));
95+
96+
default:
97+
returnreject(newErrorAjaxResponse(response));
98+
}
9099
}
91100
};
92101
}]);
@@ -156,13 +165,14 @@
156165
_extendResponse(ErrorAjaxResponse);
157166
returnErrorAjaxResponse;
158167
}.call(this),FormAjaxResponse=function(){
159-
functionFormAjaxResponse(res){
168+
functionFormAjaxResponse(res,isRejected){
160169
FormAjaxResponse.__super__.constructor.apply(this,arguments);
161170
this.type=TYPES.form;
162171
this.value=res.data.value||{};
163172
this.errors=res.data.errors||[];
164173
this.errorsCount=res.data.errorCount||this.errors.length;
165174
this.hasErrors=this.errors.length>0;
175+
isRejected===!0&&(this.success=!1);
166176
}
167177
_extendResponse(FormAjaxResponse);
168178
returnFormAjaxResponse;

‎release/angular-codey-ajaxinterceptor.js.map‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎release/angular-codey-ajaxinterceptor.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎src/models/FormResponse.js‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
varFormAjaxResponse=(function(){
2-
_extendResponse(FormAjaxResponse);
2+
_extendResponse(FormAjaxResponse);
33

4-
functionFormAjaxResponse(res){
5-
FormAjaxResponse.__super__.constructor.apply(this,arguments);
4+
functionFormAjaxResponse(res,isRejected){
5+
FormAjaxResponse.__super__.constructor.apply(this,arguments);
66

7-
this.type=TYPES.form;
8-
this.value=res.data.value||{};
9-
this.errors=res.data.errors||[];
10-
this.errorsCount=res.data.errorCount||this.errors.length;
11-
this.hasErrors=(this.errors.length>0);
7+
this.type=TYPES.form;
8+
this.value=res.data.value||{};
9+
this.errors=res.data.errors||[];
10+
this.errorsCount=res.data.errorCount||this.errors.length;
11+
this.hasErrors=(this.errors.length>0);
12+
if(isRejected===true){
13+
this.success=false;
1214
}
15+
}
1316

14-
returnFormAjaxResponse;
17+
returnFormAjaxResponse;
1518
}).call(this);

‎src/provider.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@
5454
returnreject(response);
5555
}
5656

57-
returnreject(newErrorAjaxResponse(response));
57+
switch(response.config.adapt){
58+
case'form':
59+
returnreject(newFormAjaxResponse(response,true));
60+
break;
61+
62+
default:
63+
returnreject(newErrorAjaxResponse(response));
64+
}
65+
5866
}
5967
};
6068
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp