diff --git a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/subpages/CourseContentEdition.tsx b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/subpages/CourseContentEdition.tsx index b7fe651d..b3634d5f 100644 --- a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/subpages/CourseContentEdition.tsx +++ b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/subpages/CourseContentEdition.tsx @@ -8,7 +8,7 @@ import { useRouter } from "next/navigation"; import NewChapterModal from "@components/Objects/Modals/Chapters/NewChapter"; import NewActivityModal from "@components/Objects/Modals/Activities/Create/NewActivity"; import { createActivity, createFileActivity, createExternalVideoActivity } from "@services/courses/activities"; -import { getOrganizationContextInfo } from "@services/organizations/orgs"; +import { getOrganizationContextInfo, getOrganizationContextInfoWithoutCredentials } from "@services/organizations/orgs"; import Modal from "@components/StyledElements/Modal/Modal"; import { denyAccessToUser } from "@services/utils/react/middlewares/views"; import { Folders, Hexagon, SaveIcon } from "lucide-react"; @@ -71,7 +71,7 @@ function CourseContentEdition(props: any) { // Submit new activity const submitActivity = async (activity: any) => { - let org = await getOrganizationContextInfo(orgslug, { revalidate: 1800 }); + let org = await getOrganizationContextInfoWithoutCredentials(orgslug, { revalidate: 1800 }); await updateChaptersMetadata(courseid, data); await createActivity(activity, activity.chapterId, org.org_id); mutate(`${getAPIUrl()}chapters/meta/course_${courseid}`); diff --git a/front/components/Objects/Menu/Menu.tsx b/front/components/Objects/Menu/Menu.tsx index bdf5dcb4..f99bfe2e 100644 --- a/front/components/Objects/Menu/Menu.tsx +++ b/front/components/Objects/Menu/Menu.tsx @@ -2,7 +2,7 @@ import React from "react"; import Link from "next/link"; import { getUriWithOrg } from "@services/config/config"; -import { getOrganizationContextInfo } from "@services/organizations/orgs"; +import { getOrganizationContextInfo, getOrganizationContextInfoWithoutCredentials } from "@services/organizations/orgs"; import ClientComponentSkeleton from "@components/Utils/ClientComp"; import { HeaderProfileBox } from "@components/Security/HeaderProfileBox"; import MenuLinks from "./MenuLinks"; @@ -10,7 +10,7 @@ import { getOrgLogoMediaDirectory } from "@services/media/media"; export const Menu = async (props: any) => { const orgslug = props.orgslug; - const org = await getOrganizationContextInfo(orgslug, { revalidate: 0, tags: ['organizations'] }); + const org = await getOrganizationContextInfoWithoutCredentials(orgslug, { revalidate: 0, tags: ['organizations'] }); return ( <>
{ - const org = await getOrganizationContextInfo(orgslug, { revalidate: 360, tags: ['organizations'] }); + const org = await getOrganizationContextInfoWithoutCredentials(orgslug, { revalidate: 360, tags: ['organizations'] }); setOrgId(org.org_id); } diff --git a/front/components/Security/AuthProvider.tsx b/front/components/Security/AuthProvider.tsx index 364c8971..5055457f 100644 --- a/front/components/Security/AuthProvider.tsx +++ b/front/components/Security/AuthProvider.tsx @@ -62,12 +62,11 @@ const AuthProvider = ({ children }: any) => { } } catch (error) { - + console.log(error); } } useEffect(() => { - checkRefreshToken(); checkAuth(); return () => { auth.isLoading = false; diff --git a/front/services/organizations/orgs.ts b/front/services/organizations/orgs.ts index 1a2c6d32..c70d6019 100644 --- a/front/services/organizations/orgs.ts +++ b/front/services/organizations/orgs.ts @@ -24,7 +24,22 @@ export async function getOrganizationContextInfo(org_slug: any, next: any) { return res; } +export async function getOrganizationContextInfoWithoutCredentials(org_slug: any, next: any) { + let HeadersConfig = new Headers({ "Content-Type": "application/json" }); + let options: any = { + method: 'GET', + headers: HeadersConfig, + redirect: "follow", + // Next.js + next: next, + }; + + const result = await fetch(`${getAPIUrl()}orgs/slug/${org_slug}`, options); + const res = await errorHandling(result); + return res; +} + export function getOrganizationContextInfoNoAsync(org_slug: any, next: any) { const result = fetch(`${getAPIUrl()}orgs/slug/${org_slug}`, RequestBody("GET", null, next)); return result; -} \ No newline at end of file +}