Skip to content

Commit

Permalink
fix(vue): query params prop validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bietkul committed Mar 29, 2023
1 parent 2a67d69 commit a5c657f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 43 deletions.
15 changes: 9 additions & 6 deletions packages/vue/src/components/ReactiveBase/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isEqual, transformRequestUsingEndpoint } from '@appbaseio/reactivecore/
import { updateAnalyticsConfig } from '@appbaseio/reactivecore/lib/actions/analytics';
import VueTypes from 'vue-types';
import Appbase from 'appbase-js';
import AppbaseAnalytics from '@appbaseio/analytics'
import AppbaseAnalytics from '@appbaseio/analytics';
import 'url-search-params-polyfill';

import Provider from '../Provider';
Expand Down Expand Up @@ -38,7 +38,6 @@ const ReactiveBase = {
enableAppbase: VueTypes.bool.def(false),
credentials: types.string,
headers: types.headers,
queryParams: types.string,
theme: VueTypes.object.def({}),
themePreset: VueTypes.string.def('light'),
type: types.string,
Expand Down Expand Up @@ -207,7 +206,8 @@ const ReactiveBase = {
credentials: appbaseRef.credentials,
// When endpoint prop is used index is not defined, so we use _default
index: appbaseRef.app || '_default',
globalCustomEvents: this.$props.appbaseConfig && this.$props.appbaseConfig.customEvents,
globalCustomEvents:
this.$props.appbaseConfig && this.$props.appbaseConfig.customEvents,
};

try {
Expand All @@ -217,10 +217,13 @@ const ReactiveBase = {
/\/\/(.*?)\/.*/,
'//$1',
);
const headerCredentials = this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
analyticsInitConfig.credentials = headerCredentials && headerCredentials.replace('Basic ', '');
const headerCredentials
= this.$props.endpoint.headers && this.$props.endpoint.headers.Authorization;
analyticsInitConfig.credentials
= headerCredentials && headerCredentials.replace('Basic ', '');
// Decode the credentials
analyticsInitConfig.credentials = analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
analyticsInitConfig.credentials
= analyticsInitConfig.credentials && atob(analyticsInitConfig.credentials);
}
} catch (e) {
console.error('Endpoint not set correctly for analytics');
Expand Down
1 change: 1 addition & 0 deletions packages/vue/src/utils/vueTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const types = {
useCache: VueTypes.bool,
customEvents: VueTypes.object,
enableTelemetry: VueTypes.bool.def(true),
queryParams: VueTypes.object,
}).def({}),
mongodb: VueTypes.shape({
db: VueTypes.string,
Expand Down
37 changes: 0 additions & 37 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -163,17 +163,6 @@
tocbot "^4.18.0"
yarn "^1.22.18"

"@appbaseio/[email protected]":
version "10.0.0-alpha.3"
resolved "https://registry.yarnpkg.com/@appbaseio/reactivecore/-/reactivecore-10.0.0-alpha.3.tgz#21c7db36664acf9a652238ea1df7a6599edca531"
integrity sha512-LievnS/UYyN4j6VZ2eaNkwm3VwfYM1zLttJ92ydyN2S71QXqmLjZtx941zLCILdzYXVzd3sV+YaOf0a+E/mmEQ==
dependencies:
cross-fetch "^3.0.4"
dayjs "^1.11.7"
prop-types "^15.6.0"
redux "^4.0.0"
redux-thunk "^2.3.0"

"@appbaseio/[email protected]":
version "4.0.0-rc"
resolved "https://registry.yarnpkg.com/@appbaseio/reactivemaps/-/reactivemaps-4.0.0-rc.tgz#f410820e3a9e38595e4e9f434cb95bfd4ca78d9f"
Expand All @@ -191,32 +180,6 @@
prop-types "^15.6.0"
react-leaflet "^2.1.3"

"@appbaseio/[email protected]":
version "4.0.0-rc.1"
resolved "https://registry.yarnpkg.com/@appbaseio/reactivesearch/-/reactivesearch-4.0.0-rc.1.tgz#4eb81a5a097d8e33ea3cee8eb7b847d2afaa3a18"
integrity sha512-qIHrGlBrc1hvI1oshNVNfFIyARVdoWrITtfl6mzOfwNrhFwMHcR0SxtoV5fcWY0MGCTiVv90T3QPibBQ45HG4Q==
dependencies:
"@appbaseio/analytics" "^1.1.1"
"@appbaseio/reactivecore" "10.0.0-alpha.3"
"@appbaseio/rheostat" "^1.0.0-alpha.15"
"@emotion/core" "^10.0.28"
"@emotion/styled" "^10.0.27"
appbase-js "^5.2.0"
cross-env "^5.2.0"
dayjs "^1.11.7"
downshift "^1.31.2"
echarts "^5.3.3"
echarts-for-react "^3.0.2"
emotion-theming "^10.0.27"
hoist-non-react-statics "^3.2.1"
hotkeys-js "^3.8.7"
polished "^1.9.3"
prop-types "^15.6.0"
react-day-picker "^7.0.5"
react-redux "^6.0.1"
url-search-params-polyfill "^7.0.0"
xss "^1.0.11"

"@appbaseio/rheostat@^1.0.0-alpha.15":
version "1.0.0-alpha.15"
resolved "https://registry.yarnpkg.com/@appbaseio/rheostat/-/rheostat-1.0.0-alpha.15.tgz#c4db000c7e0adf973aaf95951ab9b4e90d806b26"
Expand Down

0 comments on commit a5c657f

Please sign in to comment.