Skip to content

Commit 5cf950b

Browse files
committed
update formbricks attrs and add api errors
1 parent 4a3223c commit 5cf950b

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

assets/src/dashboard/parts/connected/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ if ( 'undefined' !== typeof window && optimoleDashboardApp.user_data.plan ) {
3232
status: optimoleDashboardApp.user_data.status,
3333
language: optimoleDashboardApp.language,
3434
cname_assigned: optimoleDashboardApp.user_data.is_cname_assigned || 'no',
35-
connected_websites: optimoleDashboardApp.user_data.whitelist.length,
36-
traffic: convertToCategory( optimoleDashboardApp.user_data.traffic, 500 ),
37-
images_number: convertToCategory( optimoleDashboardApp.user_data.images_number, 100 ),
38-
days_since_install: convertToCategory( optimoleDashboardApp.days_since_install )
35+
connected_websites: optimoleDashboardApp.user_data.whitelist.length.toString(),
36+
traffic: convertToCategory( optimoleDashboardApp.user_data.traffic, 500 ).toString(),
37+
images_number: convertToCategory( optimoleDashboardApp.user_data.images_number, 100 ).toString(),
38+
days_since_install: convertToCategory( optimoleDashboardApp.days_since_install ).toString()
3939
}
4040
});
4141

inc/api.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,19 @@ private function request( $path, $method = 'GET', $params = [], $extra_headers =
214214
&& isset( $response['code'] ) && $response['code'] === 'not_allowed' ) {
215215
return 'disconnect';
216216
}
217-
return false;
217+
218+
return isset( $response['error'] ) ? new WP_Error(
219+
'api_error',
220+
wp_kses(
221+
$response['error'],
222+
[
223+
'a' => [
224+
'href' => [],
225+
'target' => [],
226+
],
227+
]
228+
)
229+
) : false;
218230
}
219231

220232
return $response['data'];

0 commit comments

Comments
 (0)