cartodb-4.42/lib/assets/javascripts/new-dashboard/router/hooks/fetch-oauth-apps.js

23 lines
483 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
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);
}