PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / PageCreator / state / plugins-cache.js

plugins-cache.js in Extendify 2.2.0, at src/PageCreator/state/plugins-cache.js

27 lines 666 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import apiFetch from '@wordpress/api-fetch';
2 import { create } from 'zustand';
3 import { persist } from 'zustand/middleware';
4
5 export const useInstalledPluginsCache = create(
6 persist(
7 (set) => ({
8 installedPlugins: window.extSharedData?.activePlugins?.map(
9 (plugin) => plugin.split('/')[0],
10 ),
11 updateInstalledPlugins: async () => {
12 const installedPlugins = (
13 await apiFetch({
14 path: '/wp/v2/plugins',
15 method: 'GET',
16 })
17 )?.map((plugin) => plugin.plugin.split('/')[0]);
18
19 set({ installedPlugins });
20 },
21 }),
22 {
23 name: `extendify-page-creator-page-installed-plugins-cache-${window.extSharedData.siteId}`,
24 },
25 ),
26 );
27