Commit c93db18d authored by nanahira's avatar nanahira

add callback param

parent 3643a39e
Pipeline #16068 passed with stages
in 2 minutes and 19 seconds
......@@ -8,8 +8,21 @@ if (ssoString) {
sso = new URLSearchParams(Buffer.from(ssoString, 'base64').toString());
}
const callback = new URL(window.location).searchParams.get('callback');
const parseObjectPath = (obj, path, params) => {
const cbPatterns = path.split('.');
const first = cbPatterns[0];
if (cbPatterns.length === 1) {
return obj[first](...params);
}
return parseObjectPath(obj[first], cbPatterns.slice(1).join('.'), params);
}
export const handleSSO = (user, token) => {
if (callback) {
parseObjectPath(window, callback, [JSON.stringify({ ...user, token }), '']);
}
if (sso) {
const params = new URLSearchParams();
const url = new URL(sso.get('return_sso_url'));
......@@ -38,7 +51,6 @@ export const handleSSO = (user, token) => {
window.location.href = url;
return true;
} else {
return false;
}
return false;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment