This repository was archived by the owner on Mar 13, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -188,10 +188,11 @@ export async function createGroup(apiClient, groupName) {
188
188
189
189
try {
190
190
response = await apiClient . post ( `${ config . GROUPS_API_URL } ` , payload ) ;
191
+ return response . data ;
191
192
} catch ( error ) {
192
- console . log ( error ) ;
193
+ if ( error && error . message ) {
194
+ return { message : error . message } ;
195
+ }
193
196
// TODO - Handle error
194
197
}
195
-
196
- return response . data ;
197
198
}
Original file line number Diff line number Diff line change @@ -108,13 +108,15 @@ export default function SearchGroups() {
108
108
109
109
const newGroup = await groupLib . createGroup ( apiClient , groupName ) ;
110
110
111
- if ( newGroup . id ) {
111
+ if ( newGroup && newGroup . id ) {
112
112
const newOtherGroups = JSON . parse ( JSON . stringify ( otherGroups ) ) ;
113
113
114
114
newOtherGroups . push ( { ...newGroup , count : 0 } ) ;
115
115
116
116
setOtherGroups ( newOtherGroups ) ;
117
117
alert ( `Group with name ${ groupName } created successfully` ) ;
118
+ } else if ( newGroup . message ) {
119
+ alert ( newGroup . message ) ;
118
120
} else {
119
121
alert ( "Group creation failed" ) ;
120
122
}
Original file line number Diff line number Diff line change @@ -33,6 +33,13 @@ export default () => {
33
33
await loginWithRedirect ( {
34
34
redirect_uri : window . location . origin ,
35
35
} ) ;
36
+ } else if (
37
+ error . response &&
38
+ error . response . status === 409 &&
39
+ error . response . data . message
40
+ ) {
41
+ const modError = new Error ( error . response . data . message ) ;
42
+ return Promise . reject ( modError ) ;
36
43
}
37
44
38
45
return Promise . reject ( error ) ;
You can’t perform that action at this time.
0 commit comments