Skip to content

Commit

Permalink
Attempt to fix errors issues with Discord sign-in (fixes #312)
Browse files Browse the repository at this point in the history
This should be it? They’re both in places that are checking existence so this should be fine
  • Loading branch information
vcarl committed Jul 18, 2024
1 parent 80fb0fa commit 516e425
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/DiscordAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface StoredTokenError {
}
interface DiscordIdentity {
isMember: boolean;
user: {
user?: {
email: string;
verified: boolean;
};
Expand Down Expand Up @@ -45,7 +45,7 @@ const checkAuth = async (
headers: { "x-auth": stored.token },
});
const loadedUser = (await res.json()) as DiscordIdentity;
if (!loadedUser?.user.verified) {
if (!loadedUser?.user?.verified) {
return "needsVerify";
}
if (!loadedUser.isMember) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/auth/discordcb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const DiscordCB = () => {
})
.then(async (res) => {
const identity = await res.json();
if (!identity.user.email || !identity.user.verified) {
if (!identity?.user?.email || !identity?.user?.verified) {
localStorage.setItem(
"doa",
JSON.stringify({
Expand Down

0 comments on commit 516e425

Please sign in to comment.