mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed node actions
This commit is contained in:
parent
e8effb92f1
commit
0bc2ff250f
13 changed files with 107 additions and 201 deletions
|
@ -5,6 +5,7 @@ import { useOnNodeSeen } from '~/utils/hooks/node/useOnNodeSeen';
|
|||
import { apiGetNode } from '~/redux/node/api';
|
||||
import { useCallback } from 'react';
|
||||
import { INode } from '~/redux/types';
|
||||
import { EMPTY_NODE } from '~/redux/node/constants';
|
||||
|
||||
export const useGetNode = (id: number) => {
|
||||
const { data, isValidating, mutate } = useSWR<ApiGetNodeResponse>(API.NODE.GET_NODE(id), () =>
|
||||
|
@ -25,5 +26,5 @@ export const useGetNode = (id: number) => {
|
|||
|
||||
useOnNodeSeen(data?.node);
|
||||
|
||||
return { node: data?.node, isLoading: isValidating && !data, update };
|
||||
return { node: data?.node || EMPTY_NODE, isLoading: isValidating && !data, update };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue