1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-16 18:21:59 +03:00

Update CAS login to return url rather than update location as the JS SDK may not be run within a browser env

This commit is contained in:
Steven Hammerton
2015-11-06 12:11:50 +00:00
parent c3097979f2
commit b963f177cc
2 changed files with 19 additions and 7 deletions

View File

@@ -296,13 +296,23 @@ module.exports.MatrixHttpApi.prototype = {
return this._request(callback, method, fullUri, queryParams, data);
},
redirect: function(path, queryParams, prefix) {
/**
* Form and return a homeserver request URL based on the given path
* params and prefix.
* @param {string} path The HTTP path <b>after</b> the supplied prefix e.g.
* "/createRoom".
* @param {Object} queryParams A dict of query params (these will NOT be
* urlencoded).
* @param {string} prefix The full prefix to use e.g.
* "/_matrix/client/v2_alpha".
* @return {string} URL
*/
getUrl: function(path, queryParams, prefix) {
var queryString = "";
if (queryParams) {
queryString = "?" + utils.encodeParams(queryParams);
}
var fullUri = this.opts.baseUrl + prefix + path + queryString;
window.location.href = fullUri;
return this.opts.baseUrl + prefix + path + queryString;
},
_request: function(callback, method, uri, queryParams, data) {