File "DataApi.js"

Full Path: /home/leadltht/fastlinkinternet.com/admin/wp-content/wp-content/wp-content/plugins/extendify/src/Shared/api/DataApi.js
File size: 470 bytes
MIME-type: text/x-java
Charset: utf-8

import apiFetch from '@wordpress/api-fetch';

export const pingServer = async () =>
	await apiFetch({ path: '/extendify/v1/shared/ping' });

export const getPartnerPlugins = async (key) => {
	const plugins = await apiFetch({
		path: '/extendify/v1/shared/partner-plugins',
	});
	if (!Object.keys(plugins?.data ?? {}).length) {
		throw new Error('Could not get plugins');
	}
	if (key && plugins.data[key].length) {
		return plugins.data[key];
	}
	return plugins.data;
};