From e7c8b6611bbbc0de6c3b64bdc4464851ceee37a8 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel Date: Tue, 28 Jan 2020 18:12:13 +0100 Subject: [PATCH] refactor(exam-correct): refactor xsrf token and encryption options --- frontend/src/utils/exam-correct/exam-correct.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend/src/utils/exam-correct/exam-correct.js b/frontend/src/utils/exam-correct/exam-correct.js index 4ed6c1f4e..13a73f821 100644 --- a/frontend/src/utils/exam-correct/exam-correct.js +++ b/frontend/src/utils/exam-correct/exam-correct.js @@ -2,7 +2,6 @@ import { Utility } from '../../core/utility'; import { StorageManager, LOCATION } from '../../lib/storage-manager/storage-manager'; import { HttpClient } from '../../services/http-client/http-client'; -import Cookies from 'js-cookie'; import moment from 'moment'; import './exam-correct.sass'; @@ -10,7 +9,6 @@ import './exam-correct.sass'; const EXAM_CORRECT_URL_POST = 'correct'; const EXAM_CORRECT_HEADERS = { - 'X-XSRF-TOKEN': Cookies.get('XSRF-TOKEN'), 'Content-Type': HttpClient.ACCEPT.JSON, 'Accept': HttpClient.ACCEPT.JSON, }; @@ -40,7 +38,7 @@ const STATUS = { }) export class ExamCorrect { - _storageManager = new StorageManager('EXAM_CORRECT', '0.0.0', { location: LOCATION.SESSION, encrypted: true }); + _storageManager; _dateFormat; _element; @@ -65,6 +63,9 @@ export class ExamCorrect { this._element = element; this._app = app; + + this._storageManager = new StorageManager('EXAM_CORRECT', '0.0.0', { location: LOCATION.SESSION, encryption: { tag: 'exam-correct', exam: this._element.getAttribute('uw-exam-correct') } }); + this._sendBtn = document.getElementById(EXAM_CORRECT_SEND_BTN_ID); this._userInput = document.getElementById(EXAM_CORRECT_USER_INPUT_ID); this._userInputStatus = document.getElementById(EXAM_CORRECT_USER_INPUT_STATUS_ID);