export function startSync()

in space-slack-sync/client/src/app/service/syncChannels.ts [24:38]


export function startSync(setChannels: (channels: SyncedChannelInfo[]) => void) {
    const slackWorkspace = slackWorkspaces.getSelectedSlackWorkspace();
    if (slackWorkspace == null) {
        throw `Slack workspace is not defined`;
    }

    const startSyncCall = async () => {
        await fetchFromServer(
            `/api/start-sync?spaceChannelId=${chosenSpaceChannelToSync}&slackTeamId=${slackWorkspace.id}&slackChannelId=${chosenSlackChannelToSync}`,
            'POST'
        );
        await refreshChannelData(setChannels);
    };
    startSyncCall().catch(console.error);
}