Skip to content

Commit

Permalink
Fix/redirection (#633)
Browse files Browse the repository at this point in the history
* fix redirection to home page instead of dashboard site on login from dashboard

* changed link component to button
  • Loading branch information
vinayak-trivedi authored Dec 4, 2023
1 parent c71f05a commit a6434e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@
</div>
</div>
<div class="sign-in-btn">
<a
href="https://github.com/login/oauth/authorize?client_id=23c78f66ab7964e5ef97"
>Sign In <span>With GitHub</span>
<button onclick="goToAuthPage()">
Sign In <span>With GitHub</span>
<img src="images/github.png" class="user-avatar" />
</a>
</button>
</div>
<div class="user-info">
<span id="user-name"></span>
Expand Down
8 changes: 5 additions & 3 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,23 @@ img {
order: 3;
}

.sign-in-btn a {
.sign-in-btn button {
position: absolute;
right: 10px;
margin: 10px;
height: 30px;
width: fit-content;
padding: 5px;
background-color: var(--blue-color);
color: var(--white-color);
cursor: pointer;
border: 2px solid var(--white-color);
border-radius: 6px;
text-decoration: none;
font-size: 16px;
}

.sign-in-btn a img {
.sign-in-btn button img {
height: 15px;
width: 15px;
position: relative;
Expand Down Expand Up @@ -465,7 +467,7 @@ footer {
justify-content: space-between;
}

.sign-in-btn a {
.sign-in-btn button {
position: static;
}

Expand Down
6 changes: 6 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
function goToAuthPage() {
const authUrl = `https://github.com/login/oauth/authorize?client_id=23c78f66ab7964e5ef97&}&state=${window.location.href}`;

window.open(authUrl, '_self');
}

async function getSelfUser(endpoint = '/users/self') {
try {
const res = await fetch(`${API_BASE_URL}${endpoint}`, {
Expand Down

0 comments on commit a6434e6

Please sign in to comment.