mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
track marketplace activity (#10495)
This commit is contained in:
parent
4e125cd5fe
commit
a83c8239e9
@ -1,4 +1,4 @@
|
||||
import React from 'react';
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { LoadingIndicatorPage, useGlobalContext, request } from 'strapi-helper-plugin';
|
||||
import { Header } from '@buffetjs/custom';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
@ -10,20 +10,28 @@ import Wrapper from './Wrapper';
|
||||
|
||||
const MarketPlacePage = () => {
|
||||
const history = useHistory();
|
||||
const { autoReload, currentEnvironment, formatMessage, plugins } = useGlobalContext();
|
||||
const { autoReload, emitEvent, currentEnvironment, formatMessage, plugins } = useGlobalContext();
|
||||
const { error, isLoading, data } = useFetchPluginsFromMarketPlace();
|
||||
const emitEventRef = useRef(emitEvent);
|
||||
|
||||
useEffect(() => {
|
||||
emitEventRef.current('didGotToMarketplace');
|
||||
}, []);
|
||||
|
||||
if (isLoading || error) {
|
||||
return <LoadingIndicatorPage />;
|
||||
}
|
||||
|
||||
const handleDownloadPlugin = async pluginId => {
|
||||
emitEvent('willInstallPlugin', { plugin: pluginId });
|
||||
|
||||
// Force the Overlayblocker to be displayed
|
||||
const overlayblockerParams = {
|
||||
enabled: true,
|
||||
title: 'app.components.InstallPluginPage.Download.title',
|
||||
description: 'app.components.InstallPluginPage.Download.description',
|
||||
};
|
||||
|
||||
// Lock the app
|
||||
strapi.lockApp(overlayblockerParams);
|
||||
|
||||
@ -38,6 +46,7 @@ const MarketPlacePage = () => {
|
||||
const response = await request('/admin/plugins/install', opts, overlayblockerParams);
|
||||
|
||||
if (response.ok) {
|
||||
emitEvent('didInstallPlugin', { plugin: pluginId });
|
||||
// Reload the app
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user