From edecc917ad48892432cb81ae9543ee6fd4e92879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Robles?= Date: Sat, 22 Jun 2024 15:10:20 -0500 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=F0=9F=90=9E=20Improve/rethink/fix=20L?= =?UTF-8?q?ive=20Preview=20=20(#431)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parent issue: https://github.com/sequentech/meta/issues/752 --- avAdmin/admin-directives/create/create.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/avAdmin/admin-directives/create/create.js b/avAdmin/admin-directives/create/create.js index a9d2c4b3..b083edf6 100644 --- a/avAdmin/admin-directives/create/create.js +++ b/avAdmin/admin-directives/create/create.js @@ -1334,9 +1334,15 @@ angular.module('avAdmin') var foundElection = scope.elections.find(function (element) { return true === element.virtual; }); electionId = foundElection && foundElection.id || electionId; } - sessionStorage.setItem(electionId, JSON.stringify(scope.elections)); - var url = window.location.origin +"/booth/" + electionId + "/preview-vote"; - window.open(url, '_blank'); + + Authmethod.createLivePreview(JSON.stringify(scope.elections)) + .then( + function onSuccess(response) { + var previewId = response.data.id; + var url = window.location.origin +"/booth/" + electionId + "/uuid-preview-vote?uuid="+previewId; + window.open(url, '_blank'); + } + ); return true; };