Skip to content

Commit

Permalink
[UR#93] - delete spaces at the end of line
Browse files Browse the repository at this point in the history
nicitaacom authored Nov 25, 2023
2 parents fbdc62f + 9d41a16 commit a915389
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/(auth)/auth/completed/page.tsx
Original file line number Diff line number Diff line change
@@ -8,18 +8,21 @@ import { Timer } from "@/(auth)/AuthModal/components"

export default function AuthCompleted() {
const router = useRouter()
const params = useSearchParams()?.get("code")
const provider = useSearchParams()?.get("provider")
const params = useSearchParams()?.get("code")?.trimEnd()
const provider = useSearchParams()?.get("provider")?.trimEnd()
console.log(13, "provider - ", provider)

const userStore = useUserStore()

const userId = useSearchParams()?.get("userId")
const username = useSearchParams()?.get("username")
const email = useSearchParams()?.get("email")
const avatarUrl = useSearchParams()?.get("avatarUrl")
//I use ?.trimEnd() to delete spaces in end of line that cause enter in auth/callback/route.ts (NextResponse.redirect)
const userId = useSearchParams()?.get("userId")?.trimEnd()
const username = useSearchParams()?.get("username")?.trimEnd()
const email = useSearchParams()?.get("email")?.trimEnd()
const avatarUrl = useSearchParams()?.get("avatarUrl")?.trimEnd()

useEffect(() => {
userStore.setUser(userId ?? "", username ?? "", email ?? "", avatarUrl ?? "")

if (provider === "google" || provider === "twitter") return router.replace("/")
//to prevent error about too many re-renders
// eslint-disable-next-line react-hooks/exhaustive-deps

0 comments on commit a915389

Please sign in to comment.