mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2026-01-18 12:32:26 +01:00
feat: Add new data-manager service for professor and module management and a new frontend application with i18n and a professor dashboard.
This commit is contained in:
27
frontend/src/service/pocketbase.ts
Normal file
27
frontend/src/service/pocketbase.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import PocketBase from 'pocketbase';
|
||||
|
||||
// const domain = "cal.htwk-leipzig.de";
|
||||
// const baseUri = "https://" + domain;
|
||||
|
||||
// For development, we might want to use the local backend
|
||||
// const backendUrl = import.meta.env.DEV ? 'http://127.0.0.1:8090' : baseUri;
|
||||
// But since we are running in docker, the frontend might be accessing the backend via a different URL or proxy.
|
||||
// The existing code uses relative paths for API calls which go through the reverse proxy.
|
||||
// PocketBase SDK needs a full URL or it defaults to /.
|
||||
// If we are serving frontend from the same domain as backend (via proxy), / is fine.
|
||||
// However, the proxy config shows backend at /api/ and pocketbase at /_/?
|
||||
// Let's check reverseproxy.conf
|
||||
|
||||
export const pb = new PocketBase("/");
|
||||
|
||||
// Note: OAuth2 redirect URL should be configured in Keycloak/OIDC provider as:
|
||||
// Development: http://localhost/callback
|
||||
// Production: https://cal.htwk-leipzig.de/callback
|
||||
|
||||
export const login = async () => {
|
||||
await pb.collection('users').authWithOAuth2({ provider: 'oidc' });
|
||||
}
|
||||
|
||||
export const logout = () => {
|
||||
pb.authStore.clear();
|
||||
}
|
||||
Reference in New Issue
Block a user