-
|
Beta Was this translation helpful? Give feedback.
Answered by
sergiodxa
Dec 19, 2022
Replies: 1 comment 3 replies
-
You own the session storage, this means you can store anything in the session and grab it as usual in Remix async function isSubscribed(request: Request) {
let session = await sessionStorage.getSession(request.headers.get("cookie"))
let isSubscribed = session.get("isSubscribed")
if (typeof isSubscribed === "boolean") return isSubscribed
return false;
}
export async function loader({ request }: LoaderArgs) {
if (await isSubscribed(request)) {
// do something
} else {
// do something else
}
} Another option is to store that data in the value returned by the strategy verify callback, then you can use the export async function loader({ request }: LoaderArgs) {
let { isSubscribed } = await authenticator.isAuthenticated(request, {
failureRedirect: "/login"
})
// your code here
} |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
rodbs
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You own the session storage, this means you can store anything in the session and grab it as usual in Remix
Another option is to store that data in the value returned by the strategy verify callback, then you can use the
isAuthenticated
method.