mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-22 16:55:36 +02:00
rework login page, deduplicate code by using layouts
This commit is contained in:
16
web/src/routes/login/+layout.ts
Normal file
16
web/src/routes/login/+layout.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type {LayoutLoad} from './$types';
|
||||
import {env} from '$env/dynamic/public';
|
||||
|
||||
const apiUrl = env.PUBLIC_API_URL;
|
||||
|
||||
export const load: LayoutLoad = async ({fetch}) => {
|
||||
const response = await fetch(apiUrl + '/auth/metadata', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
return {oauthProvider: await response.json()};
|
||||
};
|
||||
Reference in New Issue
Block a user