diff --git a/src/App.tsx b/src/App.tsx
index 9c036fe..6ce0f59 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -1,4 +1,3 @@
-import { useEffect } from 'react'
import { Toaster } from 'sonner'
import { AppRoutes } from './app/AppRoutes'
import { useTheme } from './contexts/ThemeContext'
@@ -6,6 +5,24 @@ import { clearTeamSession } from './lib/teamAuthStorage'
const SESSION_KEY = 'yimaru_session_active'
+/**
+ * Clear persisted team tokens when this browser tab session is new.
+ * Must run before the first render so AppLayout/Login never mount protected
+ * fetches against a stale localStorage session and toast "Authorization header missing".
+ */
+function bootstrapBrowserSession() {
+ try {
+ if (!sessionStorage.getItem(SESSION_KEY)) {
+ clearTeamSession()
+ sessionStorage.setItem(SESSION_KEY, '1')
+ }
+ } catch {
+ // sessionStorage unavailable (private mode quirks) — leave tokens alone
+ }
+}
+
+bootstrapBrowserSession()
+
function AppToaster() {
const { resolvedTheme } = useTheme()
return (
@@ -26,13 +43,6 @@ function AppToaster() {
}
export default function App() {
- useEffect(() => {
- if (!sessionStorage.getItem(SESSION_KEY)) {
- clearTeamSession()
- sessionStorage.setItem(SESSION_KEY, '1')
- }
- }, [])
-
return (
<>
diff --git a/src/api/courses.api.ts b/src/api/courses.api.ts
index 0293b13..f2bb359 100644
--- a/src/api/courses.api.ts
+++ b/src/api/courses.api.ts
@@ -510,6 +510,32 @@ export const reorderModuleLessons = (
data: ReorderOrderedIdsRequest,
) => http.put(`/modules/${moduleId}/lessons/reorder`, data)
+/** PUT /exam-prep/catalog-courses/reorder */
+export const reorderExamPrepCatalogCourses = (data: ReorderOrderedIdsRequest) =>
+ http.put("/exam-prep/catalog-courses/reorder", data)
+
+/** PUT /exam-prep/catalog-courses/:catalogCourseId/units/reorder */
+export const reorderExamPrepUnitsInCatalogCourse = (
+ catalogCourseId: number,
+ data: ReorderOrderedIdsRequest,
+) =>
+ http.put(
+ `/exam-prep/catalog-courses/${catalogCourseId}/units/reorder`,
+ data,
+ )
+
+/** PUT /exam-prep/units/:unitId/modules/reorder */
+export const reorderExamPrepModulesInUnit = (
+ unitId: number,
+ data: ReorderOrderedIdsRequest,
+) => http.put(`/exam-prep/units/${unitId}/modules/reorder`, data)
+
+/** PUT /exam-prep/modules/:moduleId/lessons/reorder */
+export const reorderExamPrepLessonsInModule = (
+ moduleId: number,
+ data: ReorderOrderedIdsRequest,
+) => http.put(`/exam-prep/modules/${moduleId}/lessons/reorder`, data)
+
export const createProgramCourse = (
programId: number,
data: CreateProgramCourseRequest,
diff --git a/src/api/http.ts b/src/api/http.ts
index cb07deb..6520110 100644
--- a/src/api/http.ts
+++ b/src/api/http.ts
@@ -104,6 +104,17 @@ function isRefreshableAccessTokenError(error: AxiosError): boolean {
);
}
+/** 401s that mean "not logged in" — redirect/silent, never toast on login. */
+function isUnauthenticatedClientError(error: AxiosError): boolean {
+ if (error.response?.status !== 401) return false;
+ const message = readApiResponseMessage(error.response.data).toLowerCase();
+ return (
+ message.includes("authorization header missing") ||
+ message.includes("missing authorization") ||
+ (!getAccessToken() && !getRefreshToken())
+ );
+}
+
const refreshAccessToken = async (): Promise => {
const refreshToken = getRefreshToken();
if (!refreshToken) {
@@ -198,7 +209,9 @@ http.interceptors.response.use(
}
const skipErrorToast =
- originalRequest.skipErrorToast || isAuthEndpointRequest(originalRequest.url);
+ originalRequest.skipErrorToast ||
+ isAuthEndpointRequest(originalRequest.url) ||
+ isUnauthenticatedClientError(error);
if (!skipErrorToast && error.response) {
const message = readApiResponseMessage(error.response.data);
if (message) {
diff --git a/src/pages/content-management/ReorderContentPage.tsx b/src/pages/content-management/ReorderContentPage.tsx
index 4784182..22bb6fb 100644
--- a/src/pages/content-management/ReorderContentPage.tsx
+++ b/src/pages/content-management/ReorderContentPage.tsx
@@ -1,7 +1,14 @@
+import { useState } from "react";
import { ContentHierarchyList } from "./components/ContentHierarchyList";
+import { ExamPrepContentHierarchyList } from "./components/ExamPrepContentHierarchyList";
import { PageBackLink } from "../../components/navigation/PageBackLink";
+import { cn } from "../../lib/utils";
+
+type ReorderTab = "learn_english" | "exam_prep";
export function ReorderContentPage() {
+ const [tab, setTab] = useState("learn_english");
+
return (
@@ -12,14 +19,44 @@ export function ReorderContentPage() {
Reorder Content
- Drag and drop programs, courses, modules, and lessons to change
- their display order. Changes are saved automatically when you drop an
- item.
+ Drag and drop items to change their display order. Changes are saved
+ automatically when you drop an item.