Something went wrong. Try again.
a tool for shared writing and social publishing
Something went wrong. Try again.
847 B · 33 lines
TSX
12345678910111213141516171819202122232425262728293031323334"use client";
import { OAuthSessionError } from "src/atproto-oauth";
export function OAuthErrorMessage({ error, className,}: { error: OAuthSessionError; className?: string;}) { const signInUrl = `/api/oauth/login?redirect_url=${encodeURIComponent(window.location.href)}${error.did ? `&handle=${encodeURIComponent(error.did)}` : ""}`;
return ( <div className={`${className} leading-snug`}> <span>Your session has expired or is invalid </span> <a href={signInUrl} className="underline font-bold whitespace-nowrap"> Sign in again </a> </div> );}
export function isOAuthSessionError( error: unknown,): error is OAuthSessionError { return ( typeof error === "object" && error !== null && "type" in error && (error as OAuthSessionError).type === "oauth_session_expired" );}