Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
888 B
Text
20 lines
888 B
Text
export const resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
|
|
if (!authSchemePreference || authSchemePreference.length === 0) {
|
|
return candidateAuthOptions;
|
|
}
|
|
const preferredAuthOptions = [];
|
|
for (const preferredSchemeName of authSchemePreference) {
|
|
for (const candidateAuthOption of candidateAuthOptions) {
|
|
const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
|
|
if (candidateAuthSchemeName === preferredSchemeName) {
|
|
preferredAuthOptions.push(candidateAuthOption);
|
|
}
|
|
}
|
|
}
|
|
for (const candidateAuthOption of candidateAuthOptions) {
|
|
if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
|
|
preferredAuthOptions.push(candidateAuthOption);
|
|
}
|
|
}
|
|
return preferredAuthOptions;
|
|
};
|