Skip to content

Commit

Permalink
easy
Browse files Browse the repository at this point in the history
  • Loading branch information
0-don committed Feb 26, 2024
1 parent b255442 commit 62812b2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import { useGqlQuery } from "@/fetcher";
import { ResultOf } from "gql.tada";

interface UserDetailsModalProps {
params: { id: number };
params: { id: string };
}

export default function IdPage({ params }: UserDetailsModalProps) {
const { data: { getUserAdmin } = {}, refetch } = useGqlQuery(GET_USER_ADMIN, {
where: { id: { equals: Number(params.id) } },
where: { id: { equals: params.id } },
});
return (
<MyModal className="md:w-2/5">
<main className="mt-5 w-full rounded-lg bg-default-50 p-5">
<UserProfile
user={getUserAdmin as ResultOf<typeof GET_USER_ADMIN>["getUserAdmin"]}
user={getUserAdmin}
refetch={refetch}
/>
</main>
Expand Down
4 changes: 2 additions & 2 deletions web/src/app/[locale]/(main)/(user)/user/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { useGqlQuery } from "@/fetcher";
import { ResultOf } from "gql.tada";

interface UserDetailsPageProps {
params: { id: number };
params: { id: string };
}

export default function UserDetailsPage({ params }: UserDetailsPageProps) {
const { data: { getUserAdmin } = {}, refetch } = useGqlQuery(GET_USER_ADMIN, {
where: { id: { equals: Number(params.id) } },
where: { id: { equals: params.id } },
});
return (
<main className="mt-5 w-full max-w-3xl rounded-lg bg-default-50 p-5">
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/pages/dashboard/table/TableMealItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const TableMealItem: React.FC<TableMealItemProps> = ({
),
weeklyMealGroupId: Number(props.group),
timeOfDay: groupItem?.timeOfDay,
userId: Number(me?.id),
userId: me?.id || "",
mealId: props.meal.id,
date: dayjs(props.date).add(1, "day").toISOString(),
},
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/pages/user/settings/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ type TimeOfDayAndMealLocation = {
};

interface UserProfileProps {
user: Partial<
user?: Partial<
ResultOf<typeof GET_USER_ADMIN>["getUserAdmin"] | ResultOf<typeof ME>["me"]
>;
> | null;
refetch: (args?: any) => Promise<any>;
}

Expand Down Expand Up @@ -62,7 +62,7 @@ export const UserProfile: React.FC<UserProfileProps> = ({ user, refetch }) => {
try {
await createUserMealLocation({
data: {
userId: Number(user?.id),
userId: String(user?.id),
mealLocation:
changedState.mealLocation as keyof typeof MealLocation,
timeOfDay: changedState.timeOfDay as keyof typeof TimeOfDay,
Expand Down Expand Up @@ -292,7 +292,7 @@ export const UserProfile: React.FC<UserProfileProps> = ({ user, refetch }) => {
await deleteUserMealLocation({
where: {
id,
userId: { equals: Number(user?.id) },
userId: { equals: String(user?.id) },
},
});
onOpen();
Expand Down

0 comments on commit 62812b2

Please sign in to comment.