convert const function to function
This commit is contained in:
@@ -4,7 +4,7 @@ import useSWR from 'swr';
|
||||
|
||||
const fetcher = () => getActiveAccount();
|
||||
|
||||
export const useActiveAccount = () => {
|
||||
export function useActiveAccount() {
|
||||
const { data, error, isLoading } = useSWR('activeAcount', fetcher);
|
||||
|
||||
return {
|
||||
@@ -12,4 +12,4 @@ export const useActiveAccount = () => {
|
||||
isLoading,
|
||||
isError: error,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ const fetcher = async ([, id]) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const useChannelProfile = (id: string, channelPubkey: string) => {
|
||||
export function useChannelProfile(id: string, channelPubkey: string) {
|
||||
const pool: any = useContext(RelayContext);
|
||||
|
||||
const { data: cache, isLoading } = useSWR(['channel-cache-profile', id], fetcher);
|
||||
@@ -53,4 +53,4 @@ export const useChannelProfile = (id: string, channelPubkey: string) => {
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { nip04 } from 'nostr-tools';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
export const useDecryptMessage = (userKey: string, userPriv: string, data: any) => {
|
||||
export function useDecryptMessage(userKey: string, userPriv: string, data: any) {
|
||||
const [content, setContent] = useState(null);
|
||||
|
||||
const extractSenderKey = useCallback(() => {
|
||||
@@ -25,4 +25,4 @@ export const useDecryptMessage = (userKey: string, userPriv: string, data: any)
|
||||
}, [decrypt]);
|
||||
|
||||
return content ? content : null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
|
||||
const getOnLineStatus = () =>
|
||||
typeof navigator !== 'undefined' && typeof navigator.onLine === 'boolean' ? navigator.onLine : true;
|
||||
|
||||
export const useNetworkStatus = () => {
|
||||
export function useNetworkStatus() {
|
||||
const [status, setStatus] = useState(getOnLineStatus());
|
||||
|
||||
const setOnline = () => setStatus(true);
|
||||
@@ -20,4 +20,4 @@ export const useNetworkStatus = () => {
|
||||
}, []);
|
||||
|
||||
return status;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const fetcher = async (pubkey: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
export const useProfile = (pubkey: string) => {
|
||||
export function useProfile(pubkey: string) {
|
||||
const { data, error, isLoading } = useSWR(pubkey, fetcher);
|
||||
|
||||
return {
|
||||
@@ -30,4 +30,4 @@ export const useProfile = (pubkey: string) => {
|
||||
isLoading,
|
||||
isError: error,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user