feat: add social authentication support with enabled providers endpoint and UI integration

This commit is contained in:
Sean Morley
2025-01-06 14:25:57 -05:00
parent 4fdc16da58
commit 128c33d9a1
7 changed files with 83 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ import type { Actions, PageServerLoad, RouteParams } from './$types';
import { getRandomBackground, getRandomQuote } from '$lib';
import { fetchCSRFToken } from '$lib/index.server';
const PUBLIC_SERVER_URL = process.env['PUBLIC_SERVER_URL'];
const serverEndpoint = PUBLIC_SERVER_URL || 'http://localhost:8000';
export const load: PageServerLoad = async (event) => {
if (event.locals.user) {
@@ -12,10 +13,17 @@ export const load: PageServerLoad = async (event) => {
const quote = getRandomQuote();
const background = getRandomBackground();
let socialProviderFetch = await event.fetch(`${serverEndpoint}/auth/social-providers/`);
if (!socialProviderFetch.ok) {
return fail(500, { message: 'settings.social_providers_error' });
}
let socialProviders = await socialProviderFetch.json();
return {
props: {
quote,
background
background,
socialProviders
}
};
}