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 useSWR, { ConfigInterface, responseInterface } from 'swr';
|
||||||
import { ActivityLog, Transformers } from '@definitions/user';
|
import { ActivityLog, Transformers } from '@definitions/user';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
|
@ -13,11 +12,10 @@ const useActivityLogs = (
|
||||||
filters?: ActivityLogFilters,
|
filters?: ActivityLogFilters,
|
||||||
config?: ConfigInterface<PaginatedResult<ActivityLog>, AxiosError>
|
config?: ConfigInterface<PaginatedResult<ActivityLog>, AxiosError>
|
||||||
): responseInterface<PaginatedResult<ActivityLog>, AxiosError> => {
|
): responseInterface<PaginatedResult<ActivityLog>, AxiosError> => {
|
||||||
const uuid = ServerContext.useStoreState((state) => state.server.data?.uuid);
|
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||||
const key = useUserSWRContentKey(['server', 'activity', useFilteredObject(filters || {})]);
|
|
||||||
|
|
||||||
return useSWR<PaginatedResult<ActivityLog>>(
|
return useSWR<PaginatedResult<ActivityLog>>(
|
||||||
key,
|
['server:activty', uuid, useFilteredObject(filters || {})],
|
||||||
async () => {
|
async () => {
|
||||||
const { data } = await http.get(`/api/client/servers/${uuid}/activity`, {
|
const { data } = await http.get(`/api/client/servers/${uuid}/activity`, {
|
||||||
params: {
|
params: {
|
||||||
|
|
Loading…
Reference in a new issue