Skip to content

Commit 57fc012

Browse files
showed only message field in error toast for creating vertex schedule
1 parent 586ad4a commit 57fc012

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

src/services/Vertex.tsx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,26 @@ export class VertexServices {
9898
method: 'POST'
9999
});
100100
if (data.error) {
101-
toast.error(
102-
<ExpandToastMessage message={data.error} />,
103-
toastifyCustomStyle
101+
const jsonstr = data?.error.slice(
102+
data?.error.indexOf('{'),
103+
data?.error.lastIndexOf('}') + 1
104104
);
105+
if (jsonstr) {
106+
const errorObject = JSON.parse(jsonstr);
107+
if (errorObject.error.message) {
108+
toast.error(
109+
`Error in creating schedule : ${errorObject.error.message}`,
110+
{
111+
...toastifyCustomStyle
112+
}
113+
);
114+
} else {
115+
toast.error(
116+
<ExpandToastMessage message={data.error} />,
117+
toastifyCustomStyle
118+
);
119+
}
120+
}
105121
setCreatingVertexScheduler(false);
106122
} else {
107123
toast.success(

0 commit comments

Comments
 (0)