mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-17 13:46:47 +02:00
1. Added new schema and tests 2. Controller also accepts the data 3. Also sending fake data from frontend currently Next steps, implement service/store layer and frontend
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import useAPI from '../useApi/useApi';
|
|
|
|
const useFeatureLifecycleApi = () => {
|
|
const { makeRequest, makeLightRequest, createRequest, errors, loading } =
|
|
useAPI({
|
|
propagateErrors: true,
|
|
});
|
|
|
|
const markFeatureCompleted = async (name: string, project: string) => {
|
|
const path = `api/admin/projects/${project}/features/${name}/lifecycle/complete`;
|
|
const req = createRequest(path, {
|
|
method: 'POST',
|
|
body: JSON.stringify({ status: 'kept' }),
|
|
});
|
|
|
|
return makeRequest(req.caller, req.id);
|
|
};
|
|
|
|
const markFeatureUncompleted = async (name: string, project: string) => {
|
|
const path = `api/admin/projects/${project}/features/${name}/lifecycle/uncomplete`;
|
|
const req = createRequest(path, {
|
|
method: 'POST',
|
|
});
|
|
|
|
return makeRequest(req.caller, req.id);
|
|
};
|
|
|
|
return {
|
|
markFeatureCompleted,
|
|
markFeatureUncompleted,
|
|
errors,
|
|
loading,
|
|
};
|
|
};
|
|
|
|
export default useFeatureLifecycleApi;
|