Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All
Trying to get ticketing to work in react, tried converting Stefan's svelte code from here: https://sstoichev.eu/2021/09/09/qseow-authentication-svelte/ and this works just fine, but my react conversion gets tickets but then just keeps getting more and more in an endless loop?
import React, { useState, useEffect } from "react";
import { QlikMashupRMContext } from "../context/qlik-mashup-rm-context";
import enigma from "enigma.js";
import schema from "enigma.js/schemas/12.67.2.json";
const QlikMashupRM = () => {
const [qlikTicket, setQlikTicket] = useState();
const queryParams = new URLSearchParams(window.location.search);
useEffect(() => {
setQlikTicket(queryParams.get("qlikTicket"));
}, []);
const qsHost = "wss://qlikinstance";
const reloadURI = `https://webserver:3000/qlik-rm/`;
let qlikApps = [];
let qlikTicketString = qlikTicket ? `&QlikTicket=${qlikTicket}` : "";
const session = enigma.create({
schema,
url: `${qsHost}/app/engineData?reloadURI=${encodeURIComponent(
reloadURI
)}${qlikTicketString}`,
createSocket: (url) => new WebSocket(url),
});
session.on("notification:OnAuthenticationInformation", (data) => {
if (data.loginUri) window.location.replace(data.loginUri);
});
(async function () {
let global = await session.open();
qlikApps = await global.getDocList();
console.log(qlikApps);
await session.close();
})();
return (
<QlikMashupRMContext.Provider engine={global}>
<div>
<h1>Qlik mashup done</h1>
</div>
</QlikMashupRMContext.Provider>
);
};
export { QlikMashupRM as default };