Handle expired sessions and clean backend errors
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
import Link from "next/link";
|
||||
import { useEffect, useState } from "react";
|
||||
import { getBackendErrorMessage } from "@/lib/error-message";
|
||||
|
||||
interface AdminQueueItem {
|
||||
id: string;
|
||||
@ -54,7 +55,7 @@ export default function AdminDashboardPage() {
|
||||
});
|
||||
const result = await res.json();
|
||||
if (!res.ok) {
|
||||
throw new Error(result?.responseDesc || result?.error || "Failed to load admin dashboard");
|
||||
throw new Error(getBackendErrorMessage(result, "Failed to load admin dashboard"));
|
||||
}
|
||||
setData(result);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user