From 126cbc39a251b8d74bc225b4bd91becc6148a5ad Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Mon, 14 Nov 2022 18:57:23 +0800 Subject: [PATCH] refactor: github oauth --- public/github/cb/webapp.html | 44 ++++++++++++++++++++++ public/github/cb/widget.html | 44 ++++++++++++++++++++++ src/common/component/GithubLoginButton.tsx | 2 +- src/widget/Popup/Welcome.tsx | 4 +- 4 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 public/github/cb/webapp.html create mode 100644 public/github/cb/widget.html diff --git a/public/github/cb/webapp.html b/public/github/cb/webapp.html new file mode 100644 index 00000000..157a7ba5 --- /dev/null +++ b/public/github/cb/webapp.html @@ -0,0 +1,44 @@ + + + + + + + Document + + + +

WebApp GitHub OAuth Callback Page

+

Code not found

+ + + diff --git a/public/github/cb/widget.html b/public/github/cb/widget.html new file mode 100644 index 00000000..8d34a542 --- /dev/null +++ b/public/github/cb/widget.html @@ -0,0 +1,44 @@ + + + + + + + Document + + + +

Widget GitHub OAuth Callback Page

+

Code not found

+ + + diff --git a/src/common/component/GithubLoginButton.tsx b/src/common/component/GithubLoginButton.tsx index 0cd49972..e2130c13 100644 --- a/src/common/component/GithubLoginButton.tsx +++ b/src/common/component/GithubLoginButton.tsx @@ -49,7 +49,7 @@ const GithubLoginButton: FC = ({ type = "login", source = "webapp", clien }, [source]); const handleGithubLogin = () => { - window.open(`https://github.com/login/oauth/authorize?client_id=${client_id}&redirect_uri=${location.origin}/#/cb/github/${source}`); + window.open(`https://github.com/login/oauth/authorize?client_id=${client_id}&redirect_uri=${location.origin}/github/cb/${source}.html`); // location.href = `https://github.com/login/oauth/authorize?client_id=${client_id}`; }; diff --git a/src/widget/Popup/Welcome.tsx b/src/widget/Popup/Welcome.tsx index 96fca23f..e4e50714 100644 --- a/src/widget/Popup/Welcome.tsx +++ b/src/widget/Popup/Welcome.tsx @@ -7,7 +7,7 @@ type Props = { needLogin?: boolean } const Index = ({ needLogin = false }: Props) => { - const { name, logo } = useAppSelector(store => store.server); + const { logo } = useAppSelector(store => store.server); return ( <>
@@ -22,7 +22,7 @@ const Index = ({ needLogin = false }: Props) => {
- {needLogin &&
+ {needLogin &&
}