mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-04-26 17:27:09 -05:00
15 lines
476 B
TypeScript
15 lines
476 B
TypeScript
import { type LoaderFunction, redirect } from "react-router";
|
|
import * as UserRepository from "~/features/user-page/UserRepository.server";
|
|
import { isSupporter } from "~/modules/permissions/utils";
|
|
import { userPage } from "~/utils/urls";
|
|
|
|
export const loader: LoaderFunction = async ({ params }) => {
|
|
const user = await UserRepository.findByCustomUrl(params.customUrl!);
|
|
|
|
if (!user || !isSupporter(user)) {
|
|
return redirect("/");
|
|
}
|
|
|
|
return redirect(userPage(user));
|
|
};
|