Skip to content

Commit 185fbf7

Browse files
committed
Remove non-Promise awaits
1 parent dbb4a29 commit 185fbf7

10 files changed

Lines changed: 44 additions & 44 deletions

src/slices/aclSlice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const fetchAcls = createAppAsyncThunk("acls/fetchAcls", async (_, { getSt
9696
export const fetchAclTemplates = async () => {
9797
const data = await axios.get<{ [key: string]: string }>("/admin-ng/resources/ACL.json");
9898

99-
const response = await data.data;
99+
const response = data.data;
100100

101101
return transformToIdValueArray(response);
102102
};
@@ -105,7 +105,7 @@ export const fetchAclTemplates = async () => {
105105
export const fetchAclActions = async () => {
106106
const data = await axios.get<{ [key: string]: string }>("/admin-ng/resources/ACL.ACTIONS.json");
107107

108-
const response = await data.data;
108+
const response = data.data;
109109

110110
const actions = transformToIdValueArray(response);
111111

@@ -116,7 +116,7 @@ export const fetchAclActions = async () => {
116116
export const fetchAclDefaults = async () => {
117117
const data = await axios.get<{ [key: string]: string }>("/admin-ng/resources/ACL.DEFAULTS.json");
118118

119-
const response = await data.data;
119+
const response = data.data;
120120

121121
return response;
122122
};

src/slices/eventDetailsSlice.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ const initialState: EventDetailsState = {
614614

615615
export const fetchMetadata = createAppAsyncThunk("eventDetails/fetchMetadata", async (eventId: Event["id"]) => {
616616
const metadataRequest = await axios.get<(MetadataCatalog & { locked?: string})[]>(`/admin-ng/event/${eventId}/metadata.json`);
617-
const metadataResponse = await metadataRequest.data;
617+
const metadataResponse = metadataRequest.data;
618618

619619
const mainCatalog = "dublincore/episode";
620620
let metadata: MetadataCatalog = {
@@ -660,7 +660,7 @@ export const fetchAssets = createAppAsyncThunk("eventDetails/fetchAssets", async
660660
const assetsRequest = await axios.get<EventDetailsState["assets"]>(
661661
`/admin-ng/event/${eventId}/asset/assets.json`,
662662
);
663-
const assets = await assetsRequest.data;
663+
const assets = assetsRequest.data;
664664

665665
let transactionsReadOnly = true;
666666
const fetchTransactionResult = await dispatch(fetchHasActiveTransactions(eventId))
@@ -672,7 +672,7 @@ export const fetchAssets = createAppAsyncThunk("eventDetails/fetchAssets", async
672672
const resourceOptionsListRequest = await axios.get<{ [key: string]: string}>(
673673
"/admin-ng/resources/eventUploadAssetOptions.json",
674674
);
675-
const resourceOptionsListResponse = await resourceOptionsListRequest.data;
675+
const resourceOptionsListResponse = resourceOptionsListRequest.data;
676676

677677
const optionsData = formatUploadAssetOptions(resourceOptionsListResponse);
678678

@@ -754,7 +754,7 @@ export const fetchAssetAttachments = createAppAsyncThunk("eventDetails/fetchAsse
754754
`/admin-ng/event/${eventId}/asset/attachment/attachments.json`,
755755
{ params },
756756
);
757-
return await attachmentsRequest.data;
757+
return attachmentsRequest.data;
758758
});
759759

760760
export const fetchAssetAttachmentDetails = createAppAsyncThunk("eventDetails/fetchAssetAttachmentDetails", async (params: {
@@ -769,7 +769,7 @@ export const fetchAssetAttachmentDetails = createAppAsyncThunk("eventDetails/fet
769769
`/admin-ng/event/${eventId}/asset/attachment/${attachmentId}.json`,
770770
{ params },
771771
);
772-
return await attachmentDetailsRequest.data;
772+
return attachmentDetailsRequest.data;
773773
});
774774

775775
export const fetchAssetCatalogs = createAppAsyncThunk("eventDetails/fetchAssetCatalogs", async (eventId: Event["id"]) => {
@@ -780,7 +780,7 @@ export const fetchAssetCatalogs = createAppAsyncThunk("eventDetails/fetchAssetCa
780780
`/admin-ng/event/${eventId}/asset/catalog/catalogs.json`,
781781
{ params },
782782
);
783-
return await catalogsRequest.data;
783+
return catalogsRequest.data;
784784
});
785785

786786
export const fetchAssetCatalogDetails = createAppAsyncThunk("eventDetails/fetchAssetCatalogDetails", async (params: {
@@ -795,7 +795,7 @@ export const fetchAssetCatalogDetails = createAppAsyncThunk("eventDetails/fetchA
795795
`/admin-ng/event/${eventId}/asset/catalog/${catalogId}.json`,
796796
{ params },
797797
);
798-
return await catalogDetailsRequest.data;
798+
return catalogDetailsRequest.data;
799799
});
800800

801801
export const fetchAssetMedia = createAppAsyncThunk("eventDetails/fetchAssetMedia", async (eventId: Event["id"]) => {
@@ -813,7 +813,7 @@ export const fetchAssetMedia = createAppAsyncThunk("eventDetails/fetchAssetMedia
813813
`/admin-ng/event/${eventId}/asset/media/media.json`,
814814
{ params },
815815
);
816-
const mediaResponse = await mediaRequest.data;
816+
const mediaResponse = mediaRequest.data;
817817

818818
const media: EventDetailsState["assetMedia"] = [];
819819

@@ -844,7 +844,7 @@ export const fetchAssetMediaDetails = createAppAsyncThunk("eventDetails/fetchAss
844844
`/admin-ng/event/${eventId}/asset/media/${mediaId}.json`,
845845
{ params },
846846
);
847-
const mediaDetailsResponse = await mediaDetailsRequest.data;
847+
const mediaDetailsResponse = mediaDetailsRequest.data;
848848

849849
let mediaDetails: EventDetailsState["assetMediaDetails"];
850850

@@ -877,7 +877,7 @@ export const fetchAssetPublications = createAppAsyncThunk("eventDetails/fetchAss
877877
`/admin-ng/event/${eventId}/asset/publication/publications.json`,
878878
{ params },
879879
);
880-
return await publicationsRequest.data;
880+
return publicationsRequest.data;
881881
});
882882

883883
export const fetchAssetPublicationDetails = createAppAsyncThunk("eventDetails/fetchAssetPublicationDetails", async (params: {
@@ -892,7 +892,7 @@ export const fetchAssetPublicationDetails = createAppAsyncThunk("eventDetails/fe
892892
`/admin-ng/event/${eventId}/asset/publication/${publicationId}.json`,
893893
{ params },
894894
);
895-
return await publicationDetailsRequest.data;
895+
return publicationDetailsRequest.data;
896896
});
897897

898898
export const fetchAccessPolicies = createAppAsyncThunk("eventDetails/fetchAccessPolicies", async (id: Event["id"]) => {
@@ -905,7 +905,7 @@ export const fetchAccessPolicies = createAppAsyncThunk("eventDetails/fetchAccess
905905
const policyData = await axios.get<FetchAccessPolicies>(
906906
`/admin-ng/event/${id}/access.json`,
907907
);
908-
const accessPolicies = await policyData.data;
908+
const accessPolicies = policyData.data;
909909

910910
let policies: TransformedAcl[] = [];
911911
let currentAclTemplateId = 0;
@@ -920,12 +920,12 @@ export const fetchAccessPolicies = createAppAsyncThunk("eventDetails/fetchAccess
920920

921921
export const fetchComments = createAppAsyncThunk("eventDetails/fetchComments", async (eventId: Event["id"]) => {
922922
const commentsData = await axios.get<Comment[]>(`/admin-ng/event/${eventId}/comments`);
923-
const comments = await commentsData.data;
923+
const comments = commentsData.data;
924924

925925
const commentReasonsData = await axios.get<{ eventCommentReasons: { [key: string]: string }}>(
926926
"/admin-ng/resources/components.json",
927927
);
928-
const commentReasons = (await commentReasonsData.data).eventCommentReasons;
928+
const commentReasons = (commentReasonsData.data).eventCommentReasons;
929929

930930
return { comments, commentReasons };
931931
});
@@ -942,7 +942,7 @@ export const fetchEventPublications = createAppAsyncThunk("eventDetails/fetchEve
942942
};
943943
const data = await axios.get<FetchEventPublications>(`/admin-ng/event/${eventId}/publications.json`);
944944

945-
const publications = await data.data;
945+
const publications = data.data;
946946

947947
return await dispatch(enrichPublications(publications)).unwrap();
948948
});
@@ -1023,7 +1023,7 @@ export const fetchSchedulingInfo = createAppAsyncThunk("eventDetails/fetchSchedu
10231023
const schedulingRequest = await axios.get<FetchSchedulingInfo>(
10241024
`/admin-ng/event/${eventId}/scheduling.json`,
10251025
);
1026-
const schedulingResponse = await schedulingRequest.data;
1026+
const schedulingResponse = schedulingRequest.data;
10271027

10281028
// get data from API about capture agents
10291029
await dispatch(fetchRecordings("inputs"));
@@ -1309,7 +1309,7 @@ export const fetchWorkflows = createAppAsyncThunk("eventDetails/fetchWorkflows",
13091309
workflowId: string
13101310
}
13111311
const data = await axios.get<FetchWorkflows>(`/admin-ng/event/${eventId}/workflows.json`);
1312-
const workflowsData = await data.data;
1312+
const workflowsData = data.data;
13131313
let workflows: Workflow;
13141314

13151315
if ("results" in workflowsData) {
@@ -1354,7 +1354,7 @@ export const fetchWorkflowDetails = createAppAsyncThunk("eventDetails/fetchWorkf
13541354
const data = await axios.get<EventDetailsState["workflows"]["workflow"]>(
13551355
`/admin-ng/event/${eventId}/workflows/${workflowId}.json`,
13561356
);
1357-
return await data.data;
1357+
return data.data;
13581358
});
13591359

13601360
export const performWorkflowAction = createAppAsyncThunk("eventDetails/performWorkflowAction", async (params: {
@@ -1458,7 +1458,7 @@ export const fetchWorkflowOperations = createAppAsyncThunk("eventDetails/fetchWo
14581458
const data = await axios.get<EventDetailsState["workflowOperations"]["entries"]>(
14591459
`/admin-ng/event/${eventId}/workflows/${workflowId}/operations.json`,
14601460
);
1461-
const workflowOperationsData = await data.data;
1461+
const workflowOperationsData = data.data;
14621462
return { entries: workflowOperationsData };
14631463
});
14641464

@@ -1504,7 +1504,7 @@ export const fetchWorkflowOperationDetails = createAppAsyncThunk("eventDetails/f
15041504
const data = await axios.get<EventDetailsState["workflowOperationDetails"]>(
15051505
`/admin-ng/event/${eventId}/workflows/${workflowId}/operations/${operationId}`,
15061506
);
1507-
return await data.data;
1507+
return data.data;
15081508
});
15091509

15101510
export const fetchWorkflowErrors = createAppAsyncThunk("eventDetails/fetchWorkflowErrors", async (params: {
@@ -1515,7 +1515,7 @@ export const fetchWorkflowErrors = createAppAsyncThunk("eventDetails/fetchWorkfl
15151515
const data = await axios.get<EventDetailsState["workflowErrors"]["entries"]>(
15161516
`/admin-ng/event/${eventId}/workflows/${workflowId}/errors.json`,
15171517
);
1518-
const workflowErrorsData = await data.data;
1518+
const workflowErrorsData = data.data;
15191519
return { entries: workflowErrorsData };
15201520
});
15211521

@@ -1528,7 +1528,7 @@ export const fetchWorkflowErrorDetails = createAppAsyncThunk("eventDetails/fetch
15281528
const data = await axios.get<EventDetailsState["workflowErrorDetails"]>(
15291529
`/admin-ng/event/${eventId}/workflows/${workflowId}/errors/${errorId}.json`,
15301530
);
1531-
return await data.data;
1531+
return data.data;
15321532
});
15331533

15341534
// TODO: Fix this after the modernization of statisticsThunks happened
@@ -1638,7 +1638,7 @@ export const fetchHasActiveTransactions = createAppAsyncThunk("eventDetails/fetc
16381638
const transactionsData = await axios.get<{ active: boolean }>(
16391639
`/admin-ng/event/${eventId}/hasActiveTransaction`,
16401640
);
1641-
const hasActiveTransactions = await transactionsData.data;
1641+
const hasActiveTransactions = transactionsData.data;
16421642
return hasActiveTransactions;
16431643
});
16441644

src/slices/eventSlice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export const fetchEvents = createAppAsyncThunk("events/fetchEvents", async (_, {
287287
// fetch event metadata from server
288288
export const fetchEventMetadata = createAppAsyncThunk("events/fetchEventMetadata", async (_, { rejectWithValue }) => {
289289
const data = await axios.get<MetadataCatalog[]>("/admin-ng/event/new/metadata");
290-
const response = await data.data;
290+
const response = data.data;
291291

292292
const mainCatalog = "dublincore/episode";
293293
let metadata: EventState["metadata"] | undefined = undefined;
@@ -331,7 +331,7 @@ export const postEditMetadata = createAppAsyncThunk("events/postEditMetadata", a
331331
},
332332
},
333333
);
334-
const response = await data.data;
334+
const response = data.data;
335335

336336
// transform response
337337
const metadata = transformMetadataFields(response.metadata)
@@ -753,7 +753,7 @@ export const fetchScheduling = createAppAsyncThunk("events/fetchScheduling", asy
753753
formData,
754754
);
755755

756-
const data = await response.data;
756+
const data = response.data;
757757

758758
// transform data for further use
759759
for (const d of data) {

src/slices/groupDetailsSlice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const initialState: GroupDetailsState = {
3838
export const fetchGroupDetails = createAppAsyncThunk("groupDetails/fetchGroupDetails", async (groupId: GroupDetails["id"]) => {
3939
type FetchGroupDetails = Omit<GroupDetails, "users"> & { users: { username: string, name: string }[] };
4040
const res = await axios.get<FetchGroupDetails>(`/admin-ng/groups/${groupId}`);
41-
const response = await res.data;
41+
const response = res.data;
4242

4343
let users: GroupDetailsState["users"] = [];
4444
if (response.users.length > 0) {

src/slices/seriesSlice.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export const fetchSeries = createAppAsyncThunk("series/fetchSeries", async (_, {
142142
// fetch series metadata from server
143143
export const fetchSeriesMetadata = createAppAsyncThunk("series/fetchSeriesMetadata", async (_, { rejectWithValue }) => {
144144
const res = await axios.get<MetadataCatalog[]>("/admin-ng/series/new/metadata");
145-
const data = await res.data;
145+
const data = res.data;
146146

147147
const mainCatalog = "dublincore/series";
148148
let metadata: SeriesState["metadata"] | undefined = undefined;
@@ -289,13 +289,13 @@ export const checkForEventsDeleteSeriesModal = createAppAsyncThunk("series/check
289289
const hasEventsRequest = await axios.get<{ hasEvents: boolean }>(
290290
`/admin-ng/series/${id}/hasEvents.json`,
291291
);
292-
const hasEventsResponse = await hasEventsRequest.data;
292+
const hasEventsResponse = hasEventsRequest.data;
293293
const hasEvents = hasEventsResponse.hasEvents;
294294

295295
const deleteWithEventsAllowedRequest = await axios.get<{ deleteSeriesWithEventsAllowed: boolean }>(
296296
"/admin-ng/series/configuration.json",
297297
);
298-
const deleteWithEventsAllowedResponse = await deleteWithEventsAllowedRequest.data;
298+
const deleteWithEventsAllowedResponse = deleteWithEventsAllowedRequest.data;
299299
const deleteWithEventsAllowed =
300300
deleteWithEventsAllowedResponse.deleteSeriesWithEventsAllowed;
301301

@@ -373,7 +373,7 @@ export const fetchSeriesDetailsTobiraNew = createAppAsyncThunk("seriesDetails/fe
373373
export const fetchSeriesOptions = async () => {
374374
const data = await axios.get<{ [key: string]: string }>("/admin-ng/resources/SERIES.json");
375375

376-
const response = await data.data;
376+
const response = data.data;
377377

378378
const seriesCollection = [];
379379
for (const series of transformToIdValueArray(response)) {
@@ -387,14 +387,14 @@ export const fetchSeriesOptions = async () => {
387387
export const hasEvents = async (seriesId: Series["id"]) => {
388388
const data = await axios.get<{ hasEvents: boolean }>(`/admin-ng/series/${seriesId}/hasEvents.json`);
389389

390-
return (await data.data).hasEvents;
390+
return (data.data).hasEvents;
391391
};
392392

393393
// Get series configuration and flag indicating if series with events is allowed to delete
394394
export const getSeriesConfig = async () => {
395395
const data = await axios.get<{ deleteSeriesWithEventsAllowed: boolean }>("/admin-ng/series/configuration.json");
396396

397-
const response = await data.data;
397+
const response = data.data;
398398

399399
return !!response.deleteSeriesWithEventsAllowed;
400400
};

src/slices/tableFilterSlice.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const fetchFilters = createAppAsyncThunk("tableFilters/fetchFilters", asy
8383
const data = await axios.get<FetchFilters>(
8484
`/admin-ng/resources/${resource}/filters.json`,
8585
);
86-
const resourceData = await data.data;
86+
const resourceData = data.data;
8787

8888
const filters = transformResponse(resourceData);
8989
const filtersList: TableFilterState["data"] = Object.keys(filters.filters).map(key => {
@@ -135,7 +135,7 @@ export const fetchStats = createAppAsyncThunk("tableFilters/fetchStats", async (
135135
}
136136
// fetch information about possible status an event can have
137137
const data = await axios.get<FetchStats>("/admin-ng/resources/STATS.json");
138-
const response = await data.data;
138+
const response = data.data;
139139

140140
// transform response
141141
const statsResponse = Object.keys(response).map(key => {
@@ -176,7 +176,7 @@ export const fetchStats = createAppAsyncThunk("tableFilters/fetchStats", async (
176176
},
177177
});
178178

179-
const response = await data.data;
179+
const response = data.data;
180180

181181
// add count to status information fetched before
182182
statsResponse[i] = {

src/slices/userSlice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const fetchUsersAndUsernames = async () => {
133133
"/admin-ng/resources/USERS.NAME.AND.USERNAME.json",
134134
);
135135

136-
const response = await data.data;
136+
const response = data.data;
137137

138138
return transformToIdValueArray(response);
139139
};

src/thunks/assetsThunks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export const enrichPublications = createAppAsyncThunk("assets/enrichPublications
9595
// get information about possible publication channels
9696
const data = await axios.get<{ [key: string]: string }>("/admin-ng/resources/PUBLICATION.CHANNELS.json");
9797

98-
const publicationChannels = await data.data;
98+
const publicationChannels = data.data;
9999

100100
const now = new Date();
101101
let combinedPublications: Publication[] = [];

src/utils/adopterRegistrationUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const fetchAdopterRegistration = async () => {
1414
// fetch current information about adopter
1515
const response = await axios.get<FetchRegistration>("/admin-ng/adopter/registration");
1616

17-
return await response.data;
17+
return response.data;
1818
};
1919

2020
// get statistics information about adopter
@@ -45,7 +45,7 @@ export const fetchAdopterStatisticsSummary = async () => {
4545
};
4646
const response = await axios.get<FetchSummary>("/admin-ng/adopter/summary");
4747

48-
return await response.data;
48+
return response.data;
4949
};
5050

5151
export type Registration = {

src/utils/embeddedCodeUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const getSourceURL = async () => {
77
"/api/info/organization/properties/engageuiurl",
88
);
99

10-
const data = await response.data;
10+
const data = response.data;
1111

1212
if (data["org.opencastproject.engage.ui.url"]) {
1313
return data["org.opencastproject.engage.ui.url"];

0 commit comments

Comments
 (0)