feat: Implement default branding synchronization and improve API header handling.
This commit is contained in:
@@ -4,11 +4,15 @@ import React, { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { lmsApi } from "@/lib/api";
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { useBranding } from "@/context/BrandingContext";
|
||||
import { GraduationCap, Lock, Mail, User, ChevronLeft } from "lucide-react";
|
||||
|
||||
export default function ExperienceLoginPage() {
|
||||
const router = useRouter();
|
||||
const { login } = useAuth();
|
||||
const { branding } = useBranding();
|
||||
|
||||
const platformName = branding?.platform_name || branding?.name || 'Academia';
|
||||
|
||||
// State
|
||||
const [isLogin, setIsLogin] = useState(true);
|
||||
@@ -58,7 +62,7 @@ export default function ExperienceLoginPage() {
|
||||
<div className="inline-flex items-center justify-center w-16 h-16 bg-indigo-600 rounded-2xl mb-4 shadow-lg shadow-indigo-600/30">
|
||||
<GraduationCap className="w-8 h-8 text-white" />
|
||||
</div>
|
||||
<h1 className="text-3xl font-black text-slate-900 dark:text-white mb-2 tracking-tight">Experiencia OpenCCB</h1>
|
||||
<h1 className="text-3xl font-black text-slate-900 dark:text-white mb-2 tracking-tight">Experiencia {platformName}</h1>
|
||||
<p className="text-indigo-600 dark:text-indigo-200/60 font-medium">Portal de Aprendizaje para Estudiantes</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import { ThemeProvider } from "@/context/ThemeContext";
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "OpenCCB | Experiencia de Aprendizaje",
|
||||
description: "Consume contenido educativo de alta fidelidad con OpenCCB",
|
||||
title: "Experiencia de Aprendizaje",
|
||||
description: "Consume contenido educativo de alta fidelidad.",
|
||||
};
|
||||
|
||||
import AppHeader from "@/components/AppHeader";
|
||||
@@ -36,7 +36,7 @@ export default function RootLayout({
|
||||
</main>
|
||||
<footer className="py-12 px-6 border-t border-black/5 dark:border-white/5 text-center bg-gray-50 dark:bg-black/20">
|
||||
<p className="text-[10px] font-black uppercase tracking-[0.2em] text-gray-400 dark:text-gray-600">
|
||||
Desarrollado Por el Departamento de Informática © 2026. OpenCCB.
|
||||
© 2026. Todos los derechos reservados.
|
||||
</p>
|
||||
</footer>
|
||||
</AuthGuard>
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function AppHeader() {
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
// Use platform_name if available, otherwise name, otherwise default
|
||||
const platformName = branding?.platform_name || branding?.name || 'OpenCCB';
|
||||
const platformName = branding?.platform_name || branding?.name || 'Academia';
|
||||
|
||||
return (
|
||||
<header className="h-16 glass sticky top-0 z-[100] px-4 md:px-6 flex items-center justify-between backdrop-blur-xl bg-gray-50/70 dark:bg-black/40 border-b border-black/5 dark:border-white/5">
|
||||
|
||||
@@ -452,9 +452,10 @@ const getToken = () => {
|
||||
const apiFetch = async (url: string, options: RequestInit = {}, isCMS: boolean = false) => {
|
||||
const token = getToken();
|
||||
const baseUrl = isCMS ? getCmsApiUrl() : getLmsApiUrl();
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers,
|
||||
const isFormData = options.body instanceof FormData;
|
||||
const headers: Record<string, string> = {
|
||||
...(isFormData ? {} : { 'Content-Type': 'application/json' }),
|
||||
...Object.fromEntries(Object.entries(options.headers || {}).map(([k, v]) => [k, String(v)])),
|
||||
...(token ? { 'Authorization': `Bearer ${token}` } : {})
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user