Skip to content

Commit

Permalink
+upd: iamge for no-code-found err
Browse files Browse the repository at this point in the history
  • Loading branch information
nicitaacom committed Jul 21, 2024
1 parent 8a63e5f commit 0ce095c
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/(auth)/auth/callback/oauth/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export async function GET(request: Request) {
return NextResponse.redirect(`${requestUrl.origin}/error?error_description=${error_description}`)
}
} else {
// TODO - create image on error page for this case

const error_description = encodeURIComponent("No code found to exchange cookies for session")
return NextResponse.redirect(`${requestUrl.origin}/error?error_description=${error_description}`)
}
Expand Down
33 changes: 33 additions & 0 deletions app/error/NoCodeFoundError.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import Image from "next/image"

import useDarkMode from "@/store/ui/darkModeStore"
import { BackToMainButton } from "./components/BackToMainButton"

export function NoCodeFoundError({ message }: { message?: string }) {
const { isDarkMode } = useDarkMode()

return (
<div className="flex flex-col gap-y-4 items-center justify-center">
<div
className={`w-full h-[35vh] relative ${
isDarkMode ? "bg-[#0a6624]" : "bg-[#20e959]"
} flex justify-center items-center`}>
<Image
className="w-[200px] laptop:w-[250px] desktop:w-[300px]"
src={
isDarkMode
? "/errors/no-code-found-to-exchange-cookies-for-session-icon-dark.png"
: "/errors/no-code-found-to-exchange-cookies-for-session-icon-light.png"
}
alt="no-code-found"
width={300}
height={226}
/>
</div>
<p className="text-danger text-center">{message ? message : "No code found to exchange cookies for session"}</p>
<p className="text-center">You might pressed &quot;Cancel&quot; button when continue with google</p>
<p className="text-center">To get support contact us here - {process.env.NEXT_PUBLIC_SUPPORT_EMAIL}</p>
<BackToMainButton />
</div>
)
}
4 changes: 4 additions & 0 deletions app/error/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { EmailLinkInvalidOrExpired } from "./EmailLinkInvalidOrExpired"
import { ExchangeCookiesError } from "./ExchangeCookiesError"
import { AuthNotCompleted } from "./AuthNotCompleted"
import { BackToMainButton } from "./components/BackToMainButton"
import { NoCodeFoundError } from "./NoCodeFoundError"

export default function Error() {
const error_description = useSearchParams()?.get("error_description")
Expand All @@ -19,6 +20,9 @@ export default function Error() {
if (error_description === "No user found after exchanging cookies for recovering") {
return <ExchangeCookiesError message="No user found after exchanging cookies for recovering" />
}
if (error_description === "No code found to exchange cookies for session") {
return <NoCodeFoundError message="No user found after exchanging cookies for recovering" />
}
if (error_description === "You have no access to this route - your auth not completed") {
return <AuthNotCompleted />
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 0ce095c

Please sign in to comment.