Key activity log cache to the server instance, not the user instance.
This commit is contained in:
parent
4a8c3c4a34
commit
d6b6ac6dab
1 changed files with 2 additions and 4 deletions
|
@ -1,4 +1,3 @@
|
|||
import useUserSWRContentKey from '@/plugins/useUserSWRContentKey';
|
||||
import useSWR, { ConfigInterface, responseInterface } from 'swr';
|
||||
import { ActivityLog, Transformers } from '@definitions/user';
|
||||
import { AxiosError } from 'axios';
|
||||
|
@ -13,11 +12,10 @@ const useActivityLogs = (
|
|||
filters?: ActivityLogFilters,
|
||||
config?: ConfigInterface<PaginatedResult<ActivityLog>, AxiosError>
|
||||
): responseInterface<PaginatedResult<ActivityLog>, AxiosError> => {
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data?.uuid);
|
||||
const key = useUserSWRContentKey(['server', 'activity', useFilteredObject(filters || {})]);
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
|
||||
return useSWR<PaginatedResult<ActivityLog>>(
|
||||
key,
|
||||
['server:activty', uuid, useFilteredObject(filters || {})],
|
||||
async () => {
|
||||
const { data } = await http.get(`/api/client/servers/${uuid}/activity`, {
|
||||
params: {
|
||||
|
|
Loading…
Reference in a new issue