mirror of
https://github.com/wasp-lang/open-saas.git
synced 2025-04-10 12:59:05 +02:00
change func name
This commit is contained in:
parent
e16ce420fd
commit
7a30c41529
@ -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]
|
||||
}
|
||||
|
||||
|
@ -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]);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user