move syncMapEnabled logic to user service
This commit is contained in:
parent
f4bdbc539a
commit
17a924f9e5
|
@ -37,11 +37,10 @@ import {
|
|||
justSignedUp,
|
||||
setIsFirstLogin,
|
||||
setJustSignedUp,
|
||||
setMapEnabled,
|
||||
} from 'utils/storage';
|
||||
import {
|
||||
getMapEnabledStatus,
|
||||
isTokenValid,
|
||||
syncMapEnabled,
|
||||
validateKey,
|
||||
} from 'services/userService';
|
||||
import { useDropzone } from 'react-dropzone';
|
||||
|
@ -585,8 +584,7 @@ export default function Gallery() {
|
|||
await syncHiddenFiles(hiddenCollections, setHiddenFiles);
|
||||
await syncTrash(collections, setTrashedFiles);
|
||||
await syncEntities();
|
||||
const mapEnabled = await getMapEnabledStatus();
|
||||
setMapEnabled(mapEnabled);
|
||||
await syncMapEnabled();
|
||||
} catch (e) {
|
||||
switch (e.message) {
|
||||
case ServerErrorCodes.SESSION_EXPIRED:
|
||||
|
|
|
@ -28,6 +28,7 @@ import { B64EncryptionResult } from 'types/crypto';
|
|||
import { getLocalFamilyData, isPartOfFamily } from 'utils/user/family';
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { APPS, getAppName } from 'constants/apps';
|
||||
import { setMapEnabled } from 'utils/storage';
|
||||
|
||||
const ENDPOINT = getEndpoint();
|
||||
|
||||
|
@ -453,7 +454,17 @@ export const updateFaceSearchEnabledStatus = async (newStatus: boolean) => {
|
|||
}
|
||||
};
|
||||
|
||||
export const getMapEnabledStatus = async () => {
|
||||
export const syncMapEnabled = async () => {
|
||||
try {
|
||||
const status = await getMapEnabledStatus();
|
||||
setMapEnabled(status);
|
||||
} catch (e) {
|
||||
logError(e, 'failed to sync map enabled status');
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
const getMapEnabledStatus = async () => {
|
||||
try {
|
||||
const token = getToken();
|
||||
const resp: AxiosResponse<GetRemoteStoreValueResponse> =
|
||||
|
|
Loading…
Reference in a new issue