@@ -58,11 +58,11 @@ GovSingleConsent.prototype.init = function (
5858 Initialises _GovConsent object by performing the following:
5959 1. Removes 'uid' from URL.
6060 2. Sets 'uid' attribute from cookie or URL.
61- 3. Fetches consent status from API if 'uid' exists.
61+ 3. Fetches consent object from API if 'uid' exists.
6262 4. Notifies event listeners with API response.
6363
64- @arg updateConsentsCallback: function(status ) - callback to update consent status - response consents object passed
65- @arg revokeConsentsCallback: function() - callback to revoke all consents - error is passed
64+ @arg updateConsentsCallback: function(consent ) - callback to update consent - response consent object passed
65+ @arg revokeConsentsCallback: function() - callback to revoke all consent - error is passed
6666 */
6767
6868 validateCallbacks ( updateConsentsCallback , revokeConsentsCallback )
@@ -91,7 +91,7 @@ GovSingleConsent.prototype.init = function (
9191 getConsentsUrl ,
9292 { timeout : 1000 } ,
9393 function ( responseData ) {
94- this . updateConsentsCallback ( responseData . status )
94+ this . updateConsentsCallback ( responseData . consent )
9595 } . bind ( this )
9696 )
9797 } catch ( error ) {
@@ -100,13 +100,13 @@ GovSingleConsent.prototype.init = function (
100100 }
101101}
102102
103- GovSingleConsent . prototype . setStatus = function (
104- status ,
105- statusSetCallback ,
103+ GovSingleConsent . prototype . setConsent = function (
104+ consent ,
105+ consentsSetCallback ,
106106 onErrorCallback
107107) {
108- if ( ! status ) {
109- throw new Error ( 'status is required in GovSingleConsent.setStatus ()' )
108+ if ( ! consent ) {
109+ throw new Error ( 'consent is required in GovSingleConsent.setConsents ()' )
110110 }
111111
112112 var url = _GovConsentConfig ( )
@@ -116,8 +116,8 @@ GovSingleConsent.prototype.setStatus = function (
116116 var callback = function ( response ) {
117117 // get the current uid from the API if we don't already have one
118118 this . updateUID . bind ( this ) ( response . uid )
119- if ( statusSetCallback ) {
120- statusSetCallback ( )
119+ if ( consentsSetCallback ) {
120+ consentsSetCallback ( )
121121 }
122122 } . bind ( this )
123123
@@ -127,7 +127,7 @@ GovSingleConsent.prototype.setStatus = function (
127127 {
128128 method : 'POST' ,
129129 headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } ,
130- body : 'status =' . concat ( JSON . stringify ( status ) ) ,
130+ body : 'consent =' . concat ( JSON . stringify ( consent ) ) ,
131131 } ,
132132 callback
133133 )
0 commit comments