public function tasks() {
		$this->response->disableCache();
		Configure::write('debug', 0);
		if (!$this->request->is('ajax') || !$this->request->is('post') ||
			!$this->RequestHandler->prefers('json')) {
			throw new BadRequestException();
		}

		$data = [
			'result' => false,
			'tasks' => []
		];
		$delete = (bool)$this->request->data('delete');
		if ($delete) {
			$tasks = $this->request->data('tasks');
			$data['result'] = $this->SseTask->deleteQueuedTask($tasks);
		} else {
			$tasks = $this->SseTask->getListQueuedTask();
			$data['tasks'] = $tasks;
			$data['result'] = !empty($tasks);
		}
		$this->set(compact('data'));
		$this->set('_serialize', 'data');
	}