Explorar el Código

Clarify logic of asyncform onsuccess and onerror handlers

Shane Kilkelly hace 9 años
padre
commit
36eb453aed
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      services/web/public/coffee/directives/asyncForm.coffee

+ 4 - 2
services/web/public/coffee/directives/asyncForm.coffee

@@ -33,7 +33,8 @@ define [
 							response.success = true
 							response.error = false
 
-							if onSuccessHandler = scope[attrs.onSuccess]
+							onSuccessHandler = scope[attrs.onSuccess]
+							if onSuccessHandler
 								onSuccessHandler(data, status, headers, config)
 								return
 
@@ -55,7 +56,8 @@ define [
 							response.success = false
 							response.error = true
 
-							if onErrorHandler = scope[attrs.onError]
+							onErrorHandler = scope[attrs.onError]
+							if onErrorHandler
 								onErrorHandler(data, status, headers, config)
 								return