Skip to content

Commit

Permalink
chore: delete backend filedata
Browse files Browse the repository at this point in the history
  • Loading branch information
yp969803 committed Feb 13, 2024
1 parent 6647f10 commit 24b6897
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/app/api/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export interface FileUpload {
statusCode: number;
}

export interface IconNameRes{
message: string
}
export const uploadIcon = async (
authorizationToken: string,
orgName: string,
Expand Down Expand Up @@ -53,3 +56,20 @@ export const deleteFile = async (
});
return respnse;
};


export const getIconName = async(
authorizationToken: string,
orgName: string
): Promise<AxiosResponse<IconNameRes>>=>{
const url= BACKEND_URL+'/api/protected/file/getIconName/'+orgName
const response = await axios.get<IconNameRes>(url,
{
headers: {
Accept: 'application/json',
Authorization: `Bearer ${authorizationToken}`,
},
})
return response

}
4 changes: 4 additions & 0 deletions src/features/EditWorkspace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const EditWorkspace = () => {
}
if(token&&spaceName){
SetName(spaceName)
setUniqueName(true)
setValidName(true)
}
if(token&&spaceName){
const Org= await getOrg(token, spaceName)
Expand Down Expand Up @@ -112,6 +114,7 @@ const EditWorkspace = () => {
uniqueName &&
validDescription
) {

const func = async (): Promise<void> => {
const dataRes = await updateOrg(token,spaceName, {
name: name,
Expand All @@ -133,6 +136,7 @@ const EditWorkspace = () => {
error: <b>Could not save</b>,
});
} else {

toast.error('Invalid inputs');
}
};
Expand Down
9 changes: 8 additions & 1 deletion src/features/workspace-view/workspace-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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){}
}
};

Expand Down

0 comments on commit 24b6897

Please sign in to comment.