From 5c7f50f64bc38c520bcee8646594cb5f5ec462ce Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 30 Jun 2024 16:58:55 +0200 Subject: [PATCH] Update consent.js --- .../templates/connectors/composer-open/consent.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/edgeryders-consent/assets/javascripts/discourse/templates/connectors/composer-open/consent.js b/plugins/edgeryders-consent/assets/javascripts/discourse/templates/connectors/composer-open/consent.js index f561012a29e0b..13dcc60a475ce 100644 --- a/plugins/edgeryders-consent/assets/javascripts/discourse/templates/connectors/composer-open/consent.js +++ b/plugins/edgeryders-consent/assets/javascripts/discourse/templates/connectors/composer-open/consent.js @@ -457,11 +457,17 @@ export default { submit() { const correct = submitQuiz(); if (correct) { - const component = this + const component = this; + + const csrfToken = $('meta[name="csrf-token"]').attr('content'); + $.ajax({ url: '/u/' + User.currentProp('username') + '.json', type: 'PUT', data: "custom_fields[edgeryders_consent]=1", + headers: { + 'X-CSRF-Token': csrfToken + }, success: function (data) { jQuery('#check-button').prop('disabled', true); component.set("showQuiz", false);