gitlab-auth
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -23,4 +23,4 @@ "use strict"; | ||
// Remove oauth info from Querystring | ||
const cleanup = () => { | ||
window.history.replaceState({}, window.document.title, window.location.origin); | ||
const cleanup = (uri) => { | ||
window.history.replaceState({}, window.document.title, (uri) ? uri : window.location.href.replace(/\?.*/, "")); | ||
}; | ||
@@ -43,3 +43,6 @@ // Gitlab Auth context with gitlab api setup | ||
return (react_1.default.createElement(react_1.default.Fragment, null, | ||
react_1.default.createElement(GitlabAuthContext_1.GitlabAuthContext.Provider, { value: gitlabApi }, props.children))); | ||
react_1.default.createElement(GitlabAuthContext_1.GitlabAuthContext.Provider, { value: gitlabApi }, | ||
react_1.default.createElement(react_1.default.Fragment, null, | ||
react_1.default.createElement("a", { href: process.env.PUBLIC_URL + "/logout", onClick: () => auth.signOut(), title: "cancel sign-in" }, "Log Me Out!"), | ||
props.children)))); | ||
}; | ||
@@ -68,4 +71,7 @@ const GitlabAuth = (_a) => { | ||
}); | ||
return (react_1.default.createElement(oidc_react_1.AuthProvider, { userManager: userManager, onSignIn: () => { | ||
cleanup(); | ||
return (react_1.default.createElement(oidc_react_1.AuthProvider, { userManager: userManager, onBeforeSignIn: () => { | ||
localStorage.setItem("gitlab-auth-preauthuri", window.location.href); | ||
}, onSignIn: () => { | ||
cleanup(localStorage.getItem("gitlab-auth-preauthuri")); | ||
localStorage.removeItem("gitlab-auth-preauthuri"); | ||
} }, | ||
@@ -72,0 +78,0 @@ react_1.default.createElement(GitlabAuthContextMaker, { host: host }, children))); |
{ | ||
"name": "gitlab-auth", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "GitLab authorized API application Context", | ||
@@ -5,0 +5,0 @@ "main": "build/src/index.js", |
20512
338
2