Skip to content

Commit a4dcb8d

Browse files
committed
fix: protect axios JSON parsing
1 parent 00aa28f commit a4dcb8d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ui/src/utils/axios.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ export default (callback, store, router) => {
117117
const originalRequest = errorResponse.config
118118

119119
if (!refreshing) {
120-
const originalRequestData = JSON.parse(originalRequest.data ?? "{}");
120+
const originalRequestData = typeof originalRequest.data === "string"
121+
? JSON.parse(originalRequest.data)
122+
: (originalRequest.data ?? {});
121123

122124
// if we already tried refreshing the token,
123125
// the user simply does not have access to this feature

0 commit comments

Comments
 (0)