Skip to main content

Manual Sync

If you want to sync data by clicking a button (this function will be deprecated), you can do so. We will take the previous example of the Dashboard of Background Sync and add a button with this action.

import {
RookSummaries,
RookEvents,
} from 'capacitor-rook-sdk';


...
const handleManualSync = async () => {
try {
setSyncing(true);

// This function will be deprecated
// we hard recommend to use the background synchronization
await RookSummaries.syncYesterdaySummaries();
await RookEvents.syncEvents();
} catch (error) {
console.log(error);
} finally {
setSyncing(false);
}
};