change func name

This commit is contained in:
vincanger 2025-02-13 13:19:37 +01:00
parent e16ce420fd
commit 7a30c41529
3 changed files with 6 additions and 6 deletions

View File

@ -140,8 +140,8 @@ query getPaginatedUsers {
entities: [User]
}
action updateCurrentUser {
fn: import { updateCurrentUser } from "@src/user/operations",
action updateCurrentUserLastActiveTimestamp {
fn: import { updateCurrentUserLastActiveTimestamp } from "@src/user/operations",
entities: [User]
}

View File

@ -8,7 +8,7 @@ import { routes } from 'wasp/client/router';
import { Outlet, useLocation } from 'react-router-dom';
import { useAuth } from 'wasp/client/auth';
import { useIsLandingPage } from './hooks/useIsLandingPage';
import { updateCurrentUser } from 'wasp/client/operations';
import { updateCurrentUserLastActiveTimestamp } from 'wasp/client/operations';
/**
* use this component to wrap all child components
@ -33,7 +33,7 @@ export default function App() {
const lastSeenAt = new Date(user.lastActiveTimestamp);
const today = new Date();
if (today.getTime() - lastSeenAt.getTime() > 5 * 60 * 1000) {
updateCurrentUser({ lastActiveTimestamp: today });
updateCurrentUserLastActiveTimestamp({ lastActiveTimestamp: today });
}
}
}, [user]);

View File

@ -1,5 +1,5 @@
import {
type UpdateCurrentUser,
type UpdateCurrentUserLastActiveTimestamp,
type UpdateUserById,
type GetPaginatedUsers,
} from 'wasp/server/operations';
@ -29,7 +29,7 @@ export const updateUserById: UpdateUserById<{ id: string; data: Partial<User> },
return updatedUser;
};
export const updateCurrentUser: UpdateCurrentUser<Pick<User, 'lastActiveTimestamp'>, User> = async ({ lastActiveTimestamp }, context) => {
export const updateCurrentUserLastActiveTimestamp: UpdateCurrentUserLastActiveTimestamp<Pick<User, 'lastActiveTimestamp'>, User> = async ({ lastActiveTimestamp }, context) => {
if (!context.user) {
throw new HttpError(401);
}