File tree 1 file changed +35
-26
lines changed
src/main/webapp/WEB-INF/views/series
1 file changed +35
-26
lines changed Original file line number Diff line number Diff line change @@ -794,36 +794,42 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
794
794
/*[- */
795
795
var responseCount = 0 ;
796
796
window . axios = {
797
- post : function ( ) {
797
+ post : function ( url ) {
798
798
var possibleOutcomes = [ 'failOnForm' , 'failOnField' , 'success' ] ;
799
799
var outcome = possibleOutcomes [ responseCount % possibleOutcomes . length ] ;
800
- var stubResponse ;
801
-
802
- if ( outcome === 'failOnForm' ) {
803
- stubResponse = {
804
- status : 500 ,
805
- statusText : 'Fake Server Error'
806
- } ;
807
-
808
- } else if ( outcome === 'failOnField' ) {
809
- stubResponse = {
810
- status : 400 ,
811
- data : {
812
- "fieldErrors" : {
813
- "url" : [ "Invalid value" ]
800
+ var possibleResponses = {
801
+ '/series/sales/import' : {
802
+ 'failOnField' : {
803
+ status : 400 ,
804
+ data : {
805
+ 'fieldErrors' : {
806
+ 'url' : [ 'Invalid value' ]
807
+ }
808
+ }
809
+ } ,
810
+ 'success' : {
811
+ status : 200 ,
812
+ data : {
813
+ 'sellerId' : 3 ,
814
+ 'price' : 3.5 ,
815
+ 'currency' : 'USD'
814
816
}
815
817
}
816
- } ;
818
+ }
819
+ } ;
820
+ var stubResponse ;
817
821
818
- } else if ( outcome === 'success' ) {
819
- stubResponse = {
820
- status : 200 ,
821
- data : {
822
- "sellerId" : 3 ,
823
- "price" : 3.5 ,
824
- "currency" : "USD"
825
- }
826
- } ;
822
+ switch ( outcome ) {
823
+ case 'success' :
824
+ case 'failOnField' :
825
+ stubResponse = possibleResponses [ url ] [ outcome ] ;
826
+ break ;
827
+ case 'failOnForm' :
828
+ default :
829
+ stubResponse = {
830
+ status : 500 ,
831
+ statusText : 'Fake Server Error'
832
+ } ;
827
833
}
828
834
829
835
responseCount ++ ;
@@ -862,7 +868,10 @@ <h5 th:text="#{t_add_info_who_selling_series}">Add info about selling/buying thi
862
868
+]*/
863
869
864
870
/*[- */
865
- var importFormProps = { 'l10n' : { } } ;
871
+ var importFormProps = {
872
+ 'url' : '/series/sales/import' ,
873
+ 'l10n' : { }
874
+ } ;
866
875
/* -]*/
867
876
868
877
renderComponent ( SeriesSaleImportForm , importFormProps , 'importSeriesSaleForm' ) ;
You can’t perform that action at this time.
0 commit comments