cartodb-4.42/lib/assets/javascripts/new-dashboard/router/hooks/fetch-oauth-apps.js
2024-04-06 05:25:13 +00:00

23 lines
483 B
JavaScript

import store from 'new-dashboard/store';
export function fetchOAuthApps (_1, _2, next) {
store.dispatch('oAuthApps/fetch', {
baseUrl: store.state.user.base_url,
userId: store.state.user.id,
apiKey: store.state.user.api_key
});
next();
}
export function fetchIfAppNotFound (to, _, next) {
const appId = to.params.id;
const storeApp = store.state.oAuthApps.list[appId];
if (storeApp) {
next();
return;
}
fetchOAuthApps.apply(this, arguments);
}