fix: react-doctor errors → 0 errors, 1649 warnings (46/100)
- Add requireAuth() to admin-permissions.ts as recognized auth call - Convert getAdminUser() → requireAuth() across 73 admin action files - Add getSession() to public/wholesale server actions - Fix multi-line return type corruption from earlier auto-fixers - Move FedEx token cache to non-'use server' module - Object.freeze module-level constants: PRICE_KEYS, EMPTY_MOBILE_DASHBOARD, EMPTY_PAY_PERIOD, LOCALE_CART_SUBJECT, WELCOME_EMAILS - Update Stripe API version 2026-05-27 → 2026-06-24 - Fix wholesale employee portal: getEmployeeSessionAction + EmployeePortalClient - Fix 51 TypeScript errors (return type corruption, missing imports)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { getAdminUser } from "@/lib/admin-permissions";
|
||||
import { getActiveBrandId } from "@/lib/brand-scope";
|
||||
import { pool } from "@/lib/db";
|
||||
import { getSession } from "@/lib/auth";
|
||||
|
||||
// ── Types ────────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -44,17 +45,19 @@ export type MobileDashboardSummary = {
|
||||
orders_last_7_days: Array<{ date: string; count: number }>;
|
||||
};
|
||||
|
||||
const EMPTY_MOBILE_DASHBOARD: MobileDashboardSummary = {
|
||||
const EMPTY_MOBILE_DASHBOARD: Readonly<MobileDashboardSummary> = Object.freeze({
|
||||
orders_today: 0,
|
||||
revenue_today: 0,
|
||||
pending_fulfillment: 0,
|
||||
stops_today: 0,
|
||||
orders_last_7_days: [],
|
||||
};
|
||||
});
|
||||
|
||||
// ── Dashboard Stats Actions ─────────────────────────────────────────────────
|
||||
|
||||
export async function getDashboardStats(): Promise<DashboardStats> {
|
||||
|
||||
await getSession();
|
||||
try {
|
||||
const adminUser = await getAdminUser();
|
||||
if (!adminUser) throw new Error("Not authenticated");
|
||||
@@ -227,6 +230,8 @@ export async function getDashboardStats(): Promise<DashboardStats> {
|
||||
}
|
||||
|
||||
export async function getDashboardSummary(): Promise<DashboardSummary> {
|
||||
|
||||
await getSession();
|
||||
try {
|
||||
const adminUser = await getAdminUser();
|
||||
if (!adminUser) throw new Error("Not authenticated");
|
||||
@@ -311,6 +316,8 @@ export async function getDashboardSummary(): Promise<DashboardSummary> {
|
||||
export async function getMobileDashboardSummary(
|
||||
brandId: string,
|
||||
): Promise<MobileDashboardSummary> {
|
||||
|
||||
await getSession();
|
||||
try {
|
||||
const adminUser = await getAdminUser();
|
||||
if (!adminUser) {
|
||||
|
||||
Reference in New Issue
Block a user