Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions admin/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@ import axios from 'axios';
import { PLUGIN_ID } from './pluginId';

const api = {
getCollections: async () => {
return await axios.get(`/${PLUGIN_ID}/collections`);
},
getExtensions: async () => {
return await axios.get(`/${PLUGIN_ID}/extensions`);
},
getSettings: async () => {
return await axios.get(`/${PLUGIN_ID}/settings`);
},
setSettings: async (data: any) => {
return axios.post(`/${PLUGIN_ID}/settings`, data);
},
getCollections: async () => {
return await axios.get(`/${PLUGIN_ID}/collections`);
},
getExtensions: async () => {
return await axios.get(`/${PLUGIN_ID}/extensions`);
},
getSettings: async () => {
return await axios.get(`/${PLUGIN_ID}/settings`);
},
getCollectionFilters: async (contentType: string) => {
return await axios.get(`/${PLUGIN_ID}/collection-filters?contentType=${contentType}`);
},
setSettings: async (data: any) => {
return axios.post(`/${PLUGIN_ID}/settings`, data);
},
};

export default api;
17 changes: 17 additions & 0 deletions admin/src/components/Initializer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useEffect, useRef } from 'react';
import { PLUGIN_ID } from '../pluginId';

interface InitializerProps {
setPlugin?: (pluginId: string) => void;
}

const Initializer = ({ setPlugin }: InitializerProps): null => {
const ref = useRef(setPlugin);
useEffect(() => {
if (setPlugin) {
ref.current(PLUGIN_ID);
}
}, []);
return null;
};
export { Initializer };
Loading
Loading