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