File size: 542 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { updateLaunchpadSettings } from '@automattic/data-stores';

type SkipLaunchpadProps = {
	siteId: string | number | null;
	siteSlug: string | null;
	redirectToHome?: boolean;
};

export const skipLaunchpad = async ( {
	siteId,
	siteSlug,
	redirectToHome = true,
}: SkipLaunchpadProps ) => {
	const siteIdOrSlug = siteId || siteSlug;
	if ( siteIdOrSlug ) {
		await updateLaunchpadSettings( siteIdOrSlug, { launchpad_screen: 'skipped' } );
	}

	if ( redirectToHome ) {
		return window.location.assign( `/home/${ siteIdOrSlug }` );
	}
};