Welcome to mirror list, hosted at ThFree Co, Russian Federation.

LegacyMessagesMigrationContainer.tsx « containers « app « src « mail « applications - github.com/ProtonMail/WebClients.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6e942b8de14033de5f8ff07ad7590698e5e14099 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { useApi, useGetAddressKeys } from '@proton/components';
import { migrateAll } from '@proton/shared/lib/mail/legacyMessagesMigration/helpers';
import { useEffect } from 'react';

const LegacyMessagesMigrationContainer = () => {
    const api = useApi();
    const getAddressKeys = useGetAddressKeys();

    useEffect(() => {
        const abortController = new AbortController();
        const { signal } = abortController;
        const apiWithAbort: <T>(config: object) => Promise<T> = (config) => api({ ...config, signal });

        migrateAll({ api: apiWithAbort, getAddressKeys });

        return () => {
            abortController.abort();
        };
    }, []);

    return null;
};

export default LegacyMessagesMigrationContainer;