diff --git a/src/app/api/file.ts b/src/app/api/file.ts index 17eaf87..fb67af2 100644 --- a/src/app/api/file.ts +++ b/src/app/api/file.ts @@ -7,6 +7,9 @@ export interface FileUpload { statusCode: number; } +export interface IconNameRes{ + message: string +} export const uploadIcon = async ( authorizationToken: string, orgName: string, @@ -53,3 +56,20 @@ export const deleteFile = async ( }); return respnse; }; + + +export const getIconName = async( + authorizationToken: string, + orgName: string +): Promise>=>{ + const url= BACKEND_URL+'/api/protected/file/getIconName/'+orgName + const response = await axios.get(url, + { + headers: { + Accept: 'application/json', + Authorization: `Bearer ${authorizationToken}`, + }, + }) + return response + +} \ No newline at end of file diff --git a/src/features/EditWorkspace/index.tsx b/src/features/EditWorkspace/index.tsx index ee6475b..863c26c 100644 --- a/src/features/EditWorkspace/index.tsx +++ b/src/features/EditWorkspace/index.tsx @@ -48,6 +48,8 @@ const EditWorkspace = () => { } if(token&&spaceName){ SetName(spaceName) + setUniqueName(true) + setValidName(true) } if(token&&spaceName){ const Org= await getOrg(token, spaceName) @@ -112,6 +114,7 @@ const EditWorkspace = () => { uniqueName && validDescription ) { + const func = async (): Promise => { const dataRes = await updateOrg(token,spaceName, { name: name, @@ -133,6 +136,7 @@ const EditWorkspace = () => { error: Could not save, }); } else { + toast.error('Invalid inputs'); } }; diff --git a/src/features/workspace-view/workspace-card/index.tsx b/src/features/workspace-view/workspace-card/index.tsx index b6770e2..389c6e7 100644 --- a/src/features/workspace-view/workspace-card/index.tsx +++ b/src/features/workspace-view/workspace-card/index.tsx @@ -2,7 +2,7 @@ import React, { useContext, useEffect, useState } from 'react'; import './index.scss'; import rightNavbtn from '../../../app/assets/images/right_navigation_button.svg'; import { deleteOrg, getOrg, getOrgMembers } from 'app/api/organization'; -import { deleteFile, getIcon } from 'app/api/file'; +import { deleteFile, getIcon, getIconName } from 'app/api/file'; import { getMembers } from 'app/api/project'; import UserContext from 'app/context/user/userContext'; import toast from 'react-hot-toast'; @@ -58,6 +58,13 @@ const WorkspaceCard = (props: workspaceCardProps) => { } catch (e) {} + + try{ + + const iconRes= await getIconName(token, workspaceName) + const fileName= iconRes.data.message + const deleteRes= await deleteFile(token, fileName) + }catch(e){} } };