Triply-Dev / YASGUI.YASQE-deprecated

Deprecated, see https://github.com/TriplyDB/Yasgui for the Yasgui monorepo
MIT License
73 stars 36 forks source link

Overwriting callback function #154

Closed D063520 closed 4 years ago

D063520 commented 5 years ago

I wanted to over-right the callback function when pressing the yasqe_queryButton. I'm querying a standard endpoint put it is protected, so the user needs to authorize using a special header. As far as I see this is not possible. There is the yasqe.query() to pass a callback function, but I do not see an option to call it when pressing yasqe_queryButton since there: https://github.com/TriplyDB/YASGUI.YASQE/blob/05bb14dba3a45a750281fb29d6f6738ddecbb1dc/src/main.js#L636 the function yasqe.query() is passed on click without any argument. Is there a way to configure this? If not I would propose this as improvement.

PS: currently I'm not displaying the yasqe_queryButton and doing the functionality by putting my own button.

LaurensRietveld commented 4 years ago

Not sure what you have in mind. As of the latest version on https://github.com/TriplyDB/Yasgui you can now add headers via a callback mechanism:

const yasgui = new Yasgui(document.getElementById("yasgui"), {
  requestOpts: {
     headers: () => {
        console.log("setting headers");
        return { sdf: "gs" };
     }
  }
});

Is this what you were looking for? Or, are you looking to handle the complete query event separately? If this is still an issue, you can report it here: https://github.com/TriplyDB/Yasgui