File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/support/apis Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,22 @@ export async function submitSupportFeedback({
6767 return { error } ;
6868 }
6969
70- const data = await response . json ( ) ;
70+ try {
71+ const data = await response . json ( ) ;
7172
72- if ( ! data . success ) {
73- return { error : "API returned unsuccessful response" } ;
74- }
73+ // Validate response structure
74+ if ( typeof data !== "object" || data === null ) {
75+ return { error : "Invalid response format from API" } ;
76+ }
77+
78+ if ( ! data . success ) {
79+ return { error : "API returned unsuccessful response" } ;
80+ }
7581
76- return { success : true } ;
82+ return { success : true } ;
83+ } catch ( _jsonError ) {
84+ return { error : "Invalid JSON response from API" } ;
85+ }
7786 } catch ( error ) {
7887 if ( error instanceof Error ) {
7988 if ( error . name === "AbortError" ) return { error : "Request timeout" } ;
You can’t perform that action at this time.
0 commit comments