Add redirection feature for plugins
Change-Id: I492eb833577aaed6b36d540dae30ead0e8dd6839
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index 4027f8d..817c0c9 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -223,7 +223,7 @@
}
}
- // TODO There is no possibility to add icons to an plugin toggle button right now.
+ // TODO There is no possibility to add icons to a plugin toggle button right now.
else if (onClick["action"] == "toggle") {
// TODO:
@@ -502,12 +502,26 @@
v["q"] = p.get('q');
v["ql"] = p.get('ql');
v["cq"] = p.get('cq');
- }
- };
+ };
- // data needs to be mirrored
- if (d._id) {
- service.sendMsg(d);
+ // data needs to be mirrored
+ if (d._id) {
+ service.sendMsg(d);
+ };
+
+ break;
+
+ // Redirect to a different page relative to the current
+ case 'redirect':
+ const url = new URL(window.location);
+
+ // Currently this only accepts search parameters
+ if (d["queryParam"]) {
+ url.search = new URLSearchParams(d["queryParam"]);
+ };
+
+ window.location = url.toString();
+ break;
};
// TODO: