Skip to content

Commit 324dbbf

Browse files
authored
Fixed an error preventing the osf to load in debug mode (#1657)
This is a quick fix which prevents the osf from loading in debug mode on port 4200
1 parent 64f3290 commit 324dbbf

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mirage/factories/registration-provider.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ export default Factory.extend<MirageRegistrationProvider & RegistrationProviderT
9090
}),
9191
currentUserIsModerator: trait<RegistrationProvider>({
9292
afterCreate(provider, server) {
93-
const { currentUserId, currentUser } = server.schema.roots.first();
94-
const moderator = server.create('moderator', { id: currentUserId, user: currentUser! });
95-
provider.update({
96-
moderators: [moderator],
97-
permissions: [ReviewPermissions.ViewSubmissions],
98-
});
93+
if (server.schema.roots.first()) {
94+
const { currentUserId, currentUser } = server.schema.roots.first();
95+
const moderator = server.create('moderator', { id: currentUserId, user: currentUser! });
96+
provider.update({
97+
moderators: [moderator],
98+
permissions: [ReviewPermissions.ViewSubmissions],
99+
});
100+
}
99101
},
100102
}),
101103
});

0 commit comments

Comments
 (0)