Skip to content

Commit 5a0280c

Browse files
committed
refactor: remove unnecessary appRouter
1 parent 4319885 commit 5a0280c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/init.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,11 @@ AV.init = function init(options, ...params) {
9090
AV.setProduction(production);
9191
if (typeof disableCurrentUser !== 'undefined')
9292
AV._config.disableCurrentUser = disableCurrentUser;
93-
AV._appRouter = new AppRouter(AV);
9493
const disableAppRouter =
9594
_disableAppRouter || typeof serverURLs !== 'undefined';
95+
if (!disableAppRouter) {
96+
AV._appRouter = new AppRouter(AV);
97+
}
9698
AV._setServerURLs(
9799
extend(
98100
{},

src/request.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ const request = ({
123123
if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
124124
throw new Error('Not initialized');
125125
}
126-
AV._appRouter.refresh();
126+
if (AV._appRouter) {
127+
AV._appRouter.refresh();
128+
}
127129
const { requestTimeout: timeout } = AV._config;
128130
const url = createApiUrl({ service, path, version });
129131
return setHeaders(authOptions, signKey).then(headers =>

0 commit comments

Comments
 (0)