Key activity log cache to the server instance, not the user instance.

This commit is contained in:
DaneEveritt 2022-07-04 18:13:15 -04:00
parent 4a8c3c4a34
commit d6b6ac6dab
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -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: {