diff --git a/galasa-ui/src/components/TokenDeleteModal.tsx b/galasa-ui/src/components/TokenDeleteModal.tsx
index 89cd3ac..4047978 100644
--- a/galasa-ui/src/components/TokenDeleteModal.tsx
+++ b/galasa-ui/src/components/TokenDeleteModal.tsx
@@ -14,106 +14,106 @@ import TokenRequestModalProps from '@/utils/interfaces/TokenRequestModalProps';
export default function TokenRequestModal({ tokens, selectedTokens, deleteTokenFromSet, updateDeleteModalState }: TokenRequestModalProps) {
- const [open, setOpen] = useState(true);
- const [error, setError] = useState('');
- const [isLoading, setIsLoading] = useState(false);
+ const [open, setOpen] = useState(true);
+ const [error, setError] = useState('');
+ const [isLoading, setIsLoading] = useState(false);
- const deleteTokensById = async () => {
+ const deleteTokensById = async () => {
- try {
+ try {
- setIsLoading(true);
- //Convert set to array so we can iterate for it
- const tokensArray: Token[] = Array.from(tokens);
+ setIsLoading(true);
+ //Convert set to array so we can iterate for it
+ const tokensArray: Token[] = Array.from(tokens);
- for (const token of tokensArray) { //using loop to handle multiple token deletion at once
- if (selectedTokens.has(token.tokenId)) {
+ for (const token of tokensArray) { //using loop to handle multiple token deletion at once
+ if (selectedTokens.has(token.tokenId)) {
- const response = await fetch(`/auth/tokens`, {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ tokenId: token.tokenId }),
- });
+ const response = await fetch(`/auth/tokens`, {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({ tokenId: token.tokenId }),
+ });
- if (response.status === 204) {
+ if (response.status === 204) {
- //Update the tokens after deletion
- deleteTokenFromSet(token);
- setOpen(false);
+ //Update the tokens after deletion
+ deleteTokenFromSet(token);
+ setOpen(false);
- }
- }
- }
-
- } catch (err) {
- let errorMessage = '';
-
- if (err instanceof Error) {
- errorMessage = err.message;
- } else {
- errorMessage = String(err);
- }
-
- setError(errorMessage);
- console.error('Failed to delete a personal access token: %s', err);
- }
- finally {
- setIsLoading(false);
+ }
}
+ }
- };
+ } catch (err) {
+ let errorMessage = '';
- if (isLoading) {
- ;
- }
+ if (err instanceof Error) {
+ errorMessage = err.message;
+ } else {
+ errorMessage = String(err);
+ }
+ setError(errorMessage);
+ console.error('Failed to delete a personal access token: %s', err);
+ }
+ finally {
+ setIsLoading(false);
+ }
- return (
- <>
- {
- setOpen(false);
- setError('');
- updateDeleteModalState();
- }}
- onRequestSubmit={async () => {
- await deleteTokensById();
- }}
- >
-
- Number of access tokens to delete: {selectedTokens.size}
-
-
-
-
-
-
-
- {error && (
- setError('')}
- lowContrast
- />
- )}
-
- >
- );
+ };
+
+ if (isLoading) {
+ ;
+ }
+
+
+ return (
+ <>
+ {
+ setOpen(false);
+ setError('');
+ updateDeleteModalState();
+ }}
+ onRequestSubmit={async () => {
+ await deleteTokensById();
+ }}
+ >
+
+ Number of access tokens to delete: {selectedTokens.size}
+
+
+
+
+
+
+
+ {error && (
+ setError('')}
+ lowContrast
+ />
+ )}
+
+ >
+ );
};