diff --git a/src/frontend/src/api/CreateProjectService.ts b/src/frontend/src/api/CreateProjectService.ts
index e6b192e517..493eb946a4 100755
--- a/src/frontend/src/api/CreateProjectService.ts
+++ b/src/frontend/src/api/CreateProjectService.ts
@@ -1,4 +1,5 @@
import axios from 'axios';
+import { API } from '@/api';
import { CreateProjectActions } from '@/store/slices/CreateProjectSlice';
import {
ProjectDetailsModel,
@@ -519,6 +520,46 @@ const ValidateCustomForm: Function = (url: string, formUpload: any) => {
await validateCustomForm(url, formUpload);
};
};
+
+const DeleteProjectService: Function = (url: string) => {
+ return async (dispatch) => {
+ const deleteProject = async (url: string) => {
+ try {
+ await API.delete(url);
+ dispatch(
+ CommonActions.SetSnackBar({
+ open: true,
+ message: 'Project deleted. Redirecting...',
+ variant: 'success',
+ duration: 2000,
+ }),
+ );
+ // Redirect to homepage
+ setTimeout(() => {
+ window.location.href = '/';
+ }, 2000);
+ } catch (error) {
+ if (error.response.status === 404) {
+ dispatch(
+ CommonActions.SetSnackBar({
+ open: true,
+ message: 'Project already deleted',
+ variant: 'success',
+ duration: 2000,
+ }),
+ );
+ } else {
+ console.log(error);
+ console.log('Project deletion failed.');
+ }
+ }
+ };
+
+ await deleteProject(url);
+ // TODO extra cleanup required?
+ };
+};
+
export {
UploadAreaService,
CreateProjectService,
@@ -534,4 +575,5 @@ export {
PostFormUpdate,
EditProjectBoundaryService,
ValidateCustomForm,
+ DeleteProjectService,
};
diff --git a/src/frontend/src/components/MapDescriptionComponents.jsx b/src/frontend/src/components/MapDescriptionComponents.jsx
index 98f738dff2..83b3501a38 100755
--- a/src/frontend/src/components/MapDescriptionComponents.jsx
+++ b/src/frontend/src/components/MapDescriptionComponents.jsx
@@ -5,7 +5,7 @@ import CoreModules from '@/shared/CoreModules';
const MapDescriptionComponents = ({ type, state, defaultTheme }) => {
const descriptionData = [
{
- value: 'Descriptions',
+ value: 'Description',
element: