Skip to content

Commit

Permalink
Use first available content scope for user as default value (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelblum authored Feb 24, 2025
1 parent 354acae commit 9398e0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion admin/src/common/ContentScopeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ export const ContentScopeProvider = ({ children }: Pick<ContentScopeProviderProp
language: { value: contentScope.language, label: contentScope.language.toUpperCase() },
}));

if (user.allowedContentScopes.length === 0) {
throw new Error("User does not have access to any scopes.");
}

return (
<ContentScopeProviderLibrary<ContentScope> values={values} defaultValue={{ domain: "main", language: "en" }}>
<ContentScopeProviderLibrary<ContentScope> values={values} defaultValue={userContentScopes[0]}>
{children}
</ContentScopeProviderLibrary>
);
Expand Down

0 comments on commit 9398e0e

Please sign in to comment.