mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-02 19:26:50 -05:00
* Initial * Progress * Recent winners * Add button * Progress * Mobile nav initial * UI tweaks * Overflow * AnythingAdder links to places * Remove color for tournament showcase * Adjust SQ top banner based on if season is on right or not * Tournament participant count fixed * Log out * todo * Progress * Nav complete * Done? * Fix lint * Translate settings
23 lines
755 B
TypeScript
23 lines
755 B
TypeScript
import type { LoaderFunctionArgs } from "@remix-run/node";
|
|
import { getUserId } from "~/features/auth/core/user.server";
|
|
import { userIsBanned } from "~/features/ban/core/banned.server";
|
|
import * as UserRepository from "~/features/user-page/UserRepository.server";
|
|
import { isAdmin } from "~/permissions";
|
|
import { notFoundIfFalsy } from "~/utils/remix.server";
|
|
|
|
export const loader = async ({ params, request }: LoaderFunctionArgs) => {
|
|
const loggedInUser = await getUserId(request);
|
|
|
|
const user = notFoundIfFalsy(
|
|
await UserRepository.findProfileByIdentifier(params.identifier!),
|
|
);
|
|
|
|
return {
|
|
user,
|
|
banned:
|
|
isAdmin(loggedInUser) && userIsBanned(user.id)
|
|
? await UserRepository.findBannedStatusByUserId(user.id)!
|
|
: undefined,
|
|
};
|
|
};
|