Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Created January 13, 2023 04:59
Show Gist options
  • Save dipeshhkc/23dc9840427e11f21cd587a8d640c3e5 to your computer and use it in GitHub Desktop.
Save dipeshhkc/23dc9840427e11f21cd587a8d640c3e5 to your computer and use it in GitHub Desktop.
import type { LoaderFunction } from '@remix-run/server-runtime';
import { redirect } from '@remix-run/server-runtime';
import { getLoggedInUser } from '~/user.server';
export const loader: LoaderFunction = async () => {
const user = await getLoggedInUser();
if (!user) {
return redirect('/');
}
return user;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment