mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-04-28 13:57:51 +00:00
Format code
This commit is contained in:
parent
08a2619ccc
commit
dd99dd6959
@ -1,4 +1,4 @@
|
||||
import React, { useCallback, useEffect } from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useRecoilState, useSetRecoilState } from 'recoil';
|
||||
import {
|
||||
canSaveSettingToQdnAtom,
|
||||
@ -46,6 +46,7 @@ const getPublishRecord = async (myName) => {
|
||||
|
||||
return { hasPublishRecord: false };
|
||||
};
|
||||
|
||||
const getPublish = async (myName) => {
|
||||
try {
|
||||
let data;
|
||||
@ -57,7 +58,6 @@ const getPublish = async (myName) => {
|
||||
if (!data) throw new Error('Unable to fetch publish');
|
||||
|
||||
const decryptedKey: any = await decryptResource(data);
|
||||
|
||||
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
||||
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
||||
return decryptedKeyToObject;
|
||||
@ -112,6 +112,7 @@ export const useQortalGetSaveSettings = (myName, isAuthenticated) => {
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
!myName ||
|
||||
|
@ -1,6 +1,12 @@
|
||||
import React, { useCallback, useEffect } from 'react'
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { isUsingImportExportSettingsAtom, oldPinnedAppsAtom, settingsLocalLastUpdatedAtom, settingsQDNLastUpdatedAtom, sortablePinnedAppsAtom } from './atoms/global';
|
||||
import {
|
||||
isUsingImportExportSettingsAtom,
|
||||
oldPinnedAppsAtom,
|
||||
settingsLocalLastUpdatedAtom,
|
||||
settingsQDNLastUpdatedAtom,
|
||||
sortablePinnedAppsAtom,
|
||||
} from './atoms/global';
|
||||
|
||||
function fetchFromLocalStorage(key) {
|
||||
try {
|
||||
@ -17,39 +23,47 @@ function fetchFromLocalStorage(key) {
|
||||
|
||||
export const useRetrieveDataLocalStorage = (address) => {
|
||||
const setSortablePinnedApps = useSetRecoilState(sortablePinnedAppsAtom);
|
||||
const setSettingsLocalLastUpdated = useSetRecoilState(settingsLocalLastUpdatedAtom);
|
||||
const setIsUsingImportExportSettings = useSetRecoilState(isUsingImportExportSettingsAtom)
|
||||
const setSettingsQDNLastUpdated = useSetRecoilState(settingsQDNLastUpdatedAtom);
|
||||
const setOldPinnedApps = useSetRecoilState(oldPinnedAppsAtom)
|
||||
|
||||
const getSortablePinnedApps = useCallback(()=> {
|
||||
const pinnedAppsLocal = fetchFromLocalStorage('ext_saved_settings')
|
||||
if(pinnedAppsLocal?.sortablePinnedApps){
|
||||
setSortablePinnedApps(pinnedAppsLocal?.sortablePinnedApps)
|
||||
setSettingsLocalLastUpdated(pinnedAppsLocal?.timestamp || -1)
|
||||
const setSettingsLocalLastUpdated = useSetRecoilState(
|
||||
settingsLocalLastUpdatedAtom
|
||||
);
|
||||
|
||||
const setIsUsingImportExportSettings = useSetRecoilState(
|
||||
isUsingImportExportSettingsAtom
|
||||
);
|
||||
|
||||
const setSettingsQDNLastUpdated = useSetRecoilState(
|
||||
settingsQDNLastUpdatedAtom
|
||||
);
|
||||
|
||||
const setOldPinnedApps = useSetRecoilState(oldPinnedAppsAtom);
|
||||
|
||||
const getSortablePinnedApps = useCallback(() => {
|
||||
const pinnedAppsLocal = fetchFromLocalStorage('ext_saved_settings');
|
||||
|
||||
if (pinnedAppsLocal?.sortablePinnedApps) {
|
||||
setSortablePinnedApps(pinnedAppsLocal?.sortablePinnedApps);
|
||||
setSettingsLocalLastUpdated(pinnedAppsLocal?.timestamp || -1);
|
||||
} else {
|
||||
setSettingsLocalLastUpdated(-1)
|
||||
setSettingsLocalLastUpdated(-1);
|
||||
}
|
||||
}, []);
|
||||
|
||||
}, [])
|
||||
const getSortablePinnedAppsImportExport = useCallback(()=> {
|
||||
const pinnedAppsLocal = fetchFromLocalStorage('ext_saved_settings_import_export')
|
||||
if(pinnedAppsLocal?.sortablePinnedApps){
|
||||
setOldPinnedApps(pinnedAppsLocal?.sortablePinnedApps)
|
||||
|
||||
|
||||
setIsUsingImportExportSettings(true)
|
||||
setSettingsQDNLastUpdated(pinnedAppsLocal?.timestamp || 0)
|
||||
|
||||
const getSortablePinnedAppsImportExport = useCallback(() => {
|
||||
const pinnedAppsLocal = fetchFromLocalStorage(
|
||||
'ext_saved_settings_import_export'
|
||||
);
|
||||
if (pinnedAppsLocal?.sortablePinnedApps) {
|
||||
setOldPinnedApps(pinnedAppsLocal?.sortablePinnedApps);
|
||||
setIsUsingImportExportSettings(true);
|
||||
setSettingsQDNLastUpdated(pinnedAppsLocal?.timestamp || 0);
|
||||
} else {
|
||||
setIsUsingImportExportSettings(false)
|
||||
setIsUsingImportExportSettings(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
}, [])
|
||||
useEffect(()=> {
|
||||
|
||||
getSortablePinnedApps()
|
||||
getSortablePinnedAppsImportExport()
|
||||
}, [getSortablePinnedApps, address])
|
||||
|
||||
}
|
||||
useEffect(() => {
|
||||
getSortablePinnedApps();
|
||||
getSortablePinnedAppsImportExport();
|
||||
}, [getSortablePinnedApps, address]);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user