Skip to content

Commit fcb7e75

Browse files
committed
hotfix last???
1 parent 22fd16c commit fcb7e75

1 file changed

Lines changed: 17 additions & 91 deletions

File tree

src/pages/callback.astro

Lines changed: 17 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
import BaseHeader from "../components/BaseHeader.astro";
33
import Navigator from "../components/Navigator.astro";
44
import BaseFooter from "../components/BaseFooter.astro";
5-
import { url } from "../consts.ts";
6-
7-
const redirectUri = `${url}/callback`;
8-
const discordLoginUrl = `https://discord.com/oauth2/authorize?client_id=1358603949015564449&response_type=code&redirect_uri=${encodeURIComponent(
9-
redirectUri
10-
)}&scope=email+identify+openid`;
115
---
126

137
<html lang="ko">
@@ -28,6 +22,12 @@ const discordLoginUrl = `https://discord.com/oauth2/authorize?client_id=13586039
2822

2923
<script type="module">
3024
import Cookies from "js-cookie";
25+
import { url } from "../consts.ts";
26+
27+
const redirectUri = `${url}/callback`;
28+
const discordLoginUrl = `https://discord.com/oauth2/authorize?client_id=1358603949015564449&response_type=code&redirect_uri=${encodeURIComponent(
29+
redirectUri
30+
)}&scope=email+identify+openid`;
3131

3232
const container = document.getElementById("login-container");
3333
const storedUser = Cookies.get("user");
@@ -36,13 +36,13 @@ const discordLoginUrl = `https://discord.com/oauth2/authorize?client_id=13586039
3636
if (storedUser && storedLoggedIn === "true") {
3737
const user = JSON.parse(storedUser);
3838
container.innerHTML = `
39-
<div class="user-info">
40-
<span class="user-text">Welcome, ${user.global_name || "User"}</span>
41-
<button id="logout-btn" class="round-btn logout-btn">
42-
<span class="btn-text">Logout</span>
43-
</button>
44-
</div>
45-
`;
39+
<div class="user-info">
40+
<span class="user-text">Welcome, ${user.global_name || "User"}</span>
41+
<button id="logout-btn" class="round-btn logout-btn">
42+
<span class="btn-text">Logout</span>
43+
</button>
44+
</div>
45+
`;
4646

4747
document.getElementById("logout-btn")?.addEventListener("click", () => {
4848
Cookies.remove("user");
@@ -51,85 +51,11 @@ const discordLoginUrl = `https://discord.com/oauth2/authorize?client_id=13586039
5151
});
5252
} else {
5353
container.innerHTML = `
54-
<a href="${discordLoginUrl}" class="round-btn login-btn">
55-
<span class="btn-text">Login</span>
56-
</a>
57-
`;
54+
<a href="${discordLoginUrl}" class="round-btn login-btn">
55+
<span class="btn-text">Login</span>
56+
</a>
57+
`;
5858
}
5959
</script>
6060
</body>
6161
</html>
62-
63-
<style>
64-
.container {
65-
min-height: 100vh;
66-
justify-content: space-between;
67-
text-align: center;
68-
font-family: 'Quicksand', system-ui, Avenir, Helvetica, Arial, sans-serif;
69-
}
70-
71-
.login {
72-
margin-top: 2rem;
73-
display: flex;
74-
justify-content: center;
75-
}
76-
77-
.user-info {
78-
display: flex;
79-
flex-direction: column;
80-
align-items: center;
81-
gap: 0.5rem;
82-
}
83-
84-
.user-text {
85-
opacity: 1;
86-
transition: opacity 0.3s ease-in-out;
87-
}
88-
89-
.user-info:hover .user-text {
90-
opacity: 0;
91-
}
92-
93-
.round-btn {
94-
display: inline-flex;
95-
align-items: center;
96-
justify-content: center;
97-
overflow: hidden;
98-
white-space: nowrap;
99-
width: 40px;
100-
height: 40px;
101-
border-radius: 50%;
102-
transition: all 0.3s ease-in-out;
103-
cursor: pointer;
104-
font-size: 0.9rem;
105-
font-weight: 500;
106-
text-decoration: none;
107-
color: #fff;
108-
position: relative;
109-
}
110-
111-
.round-btn:hover {
112-
width: 120px;
113-
border-radius: 20px;
114-
justify-content: center;
115-
}
116-
117-
.btn-text {
118-
opacity: 0;
119-
margin-left: 0.5rem;
120-
transition: opacity 0.2s ease-in-out;
121-
}
122-
123-
.round-btn:hover .btn-text {
124-
opacity: 1;
125-
}
126-
127-
.login-btn {
128-
background: #86bc7b;
129-
}
130-
131-
.logout-btn {
132-
background: #c9f1a4;
133-
color: #242424;
134-
}
135-
</style>

0 commit comments

Comments
 (0)