Fix dashboard auth image preload and API base resolution
Build & Deploy / Build & Push Docker Image (push) Successful in 3m10s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 46s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Carplace Unit Tests (push) Successful in 40s
Test / Admin Unit Tests (push) Successful in 41s
Test / Dashboard Unit Tests (push) Successful in 40s
Test / API Integration Tests (push) Successful in 59s
Test / Type Check (all packages) (pull_request) Failing after 10s
Test / API Unit Tests (pull_request) Has been skipped
Test / Homepage Unit Tests (pull_request) Has been skipped
Test / Carplace Unit Tests (pull_request) Has been skipped
Test / Admin Unit Tests (pull_request) Has been skipped
Test / Dashboard Unit Tests (pull_request) Has been skipped
Test / API Integration Tests (pull_request) Has been skipped
Build & Deploy / Build & Push Docker Image (push) Successful in 3m10s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 46s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Carplace Unit Tests (push) Successful in 40s
Test / Admin Unit Tests (push) Successful in 41s
Test / Dashboard Unit Tests (push) Successful in 40s
Test / API Integration Tests (push) Successful in 59s
Test / Type Check (all packages) (pull_request) Failing after 10s
Test / API Unit Tests (pull_request) Has been skipped
Test / Homepage Unit Tests (pull_request) Has been skipped
Test / Carplace Unit Tests (pull_request) Has been skipped
Test / Admin Unit Tests (pull_request) Has been skipped
Test / Dashboard Unit Tests (pull_request) Has been skipped
Test / API Integration Tests (pull_request) Has been skipped
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { formatCurrency } from '@rentaldrivego/types'
|
||||
import { API_BASE, apiFetch } from '@/lib/api'
|
||||
import { apiFetch, resolveApiBase } from '@/lib/api'
|
||||
import { useDashboardI18n } from '@/components/I18nProvider'
|
||||
|
||||
interface ReportRow {
|
||||
@@ -110,7 +110,7 @@ export default function ReportsPage() {
|
||||
setExporting(true)
|
||||
setError(null)
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/analytics/report?period=${period}&format=CSV`, {
|
||||
const res = await fetch(`${resolveApiBase()}/analytics/report?period=${period}&format=CSV`, {
|
||||
credentials: 'include',
|
||||
})
|
||||
if (!res.ok) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { useDashboardI18n } from "@/components/I18nProvider";
|
||||
import PublicShell from "@/components/layout/PublicShell";
|
||||
import { API_BASE } from "@/lib/api";
|
||||
import { resolveApiBase } from "@/lib/api";
|
||||
import { carplaceUrl } from "@/lib/urls";
|
||||
|
||||
const DASHBOARD_LOGO_SRC = "/dashboard/rentaldrivego.png";
|
||||
@@ -69,14 +69,15 @@ export default function ForgotPasswordPageClient({
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const apiBase = resolveApiBase();
|
||||
// Try employee first, then admin — mirrors the sign-in page which handles both
|
||||
const [empRes, adminRes] = await Promise.all([
|
||||
fetch(`${API_BASE}/auth/employee/forgot-password`, {
|
||||
fetch(`${apiBase}/auth/employee/forgot-password`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ email }),
|
||||
}),
|
||||
fetch(`${API_BASE}/admin/auth/forgot-password`, {
|
||||
fetch(`${apiBase}/admin/auth/forgot-password`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ email }),
|
||||
@@ -103,7 +104,6 @@ export default function ForgotPasswordPageClient({
|
||||
alt="RentalDriveGo"
|
||||
width={104}
|
||||
height={104}
|
||||
priority
|
||||
unoptimized
|
||||
className="h-24 w-24 rounded-[1.75rem] border border-stone-200 bg-white p-1.5 shadow-sm transition-colors dark:border-blue-800 dark:bg-blue-950"
|
||||
/>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Suspense, useState } from 'react'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
import { useDashboardI18n } from '@/components/I18nProvider'
|
||||
import PublicShell from '@/components/layout/PublicShell'
|
||||
import { API_BASE } from '@/lib/api'
|
||||
import { resolveApiBase } from '@/lib/api'
|
||||
|
||||
export default function ResetPasswordPageClient({ embedded = false }: { embedded?: boolean }) {
|
||||
return (
|
||||
@@ -92,7 +92,7 @@ function ResetPasswordContent({ embedded = false }: { embedded?: boolean }) {
|
||||
setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/auth/employee/reset-password`, {
|
||||
const res = await fetch(`${resolveApiBase()}/auth/employee/reset-password`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ token, password }),
|
||||
|
||||
@@ -7,7 +7,7 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
||||
import { useDashboardI18n } from "@/components/I18nProvider";
|
||||
import PublicShell from "@/components/layout/PublicShell";
|
||||
import { adminUrl, websiteUrl } from "@/lib/urls";
|
||||
import { API_BASE, EMPLOYEE_PROFILE_KEY } from "@/lib/api";
|
||||
import { EMPLOYEE_PROFILE_KEY, resolveApiBase } from "@/lib/api";
|
||||
import { toPublicDashboardPath } from "@/lib/dashboardPaths";
|
||||
|
||||
const DASHBOARD_LOGO_SRC = "/dashboard/rentaldrivego.png";
|
||||
@@ -195,7 +195,6 @@ export default function SignInPageClient({
|
||||
alt="RentalDriveGo"
|
||||
width={104}
|
||||
height={104}
|
||||
priority
|
||||
unoptimized
|
||||
className="h-24 w-24 rounded-[1.75rem] border border-stone-200/80 bg-white/85 p-1.5 shadow-sm transition-colors dark:border-blue-800 dark:bg-blue-950/80"
|
||||
/>
|
||||
@@ -279,8 +278,10 @@ function LocalSignInForm({
|
||||
setCanResendVerification(false);
|
||||
|
||||
try {
|
||||
const apiBase = resolveApiBase();
|
||||
|
||||
const tryAdminLogin = async () => {
|
||||
const adminRes = await fetch(`${API_BASE}/admin/auth/login`, {
|
||||
const adminRes = await fetch(`${apiBase}/admin/auth/login`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
@@ -307,7 +308,7 @@ function LocalSignInForm({
|
||||
};
|
||||
|
||||
const tryEmployeeLogin = async () => {
|
||||
const empRes = await fetch(`${API_BASE}/auth/employee/login`, {
|
||||
const empRes = await fetch(`${apiBase}/auth/employee/login`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
@@ -379,7 +380,7 @@ function LocalSignInForm({
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
const res = await fetch(`${API_BASE}/auth/employee/resend-verification`, {
|
||||
const res = await fetch(`${resolveApiBase()}/auth/employee/resend-verification`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
@@ -409,7 +410,7 @@ function LocalSignInForm({
|
||||
? { totpCode: normalizedCode }
|
||||
: { recoveryCode: normalizedCode };
|
||||
|
||||
const adminRes = await fetch(`${API_BASE}/admin/auth/login`, {
|
||||
const adminRes = await fetch(`${resolveApiBase()}/admin/auth/login`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
|
||||
@@ -249,7 +249,6 @@ export default function SignUpForm({
|
||||
alt="RentalDriveGo"
|
||||
width={104}
|
||||
height={104}
|
||||
priority
|
||||
unoptimized
|
||||
className="h-24 w-24 rounded-[1.75rem] border border-stone-200/80 bg-white/85 p-1.5 shadow-sm transition-colors dark:border-blue-800 dark:bg-blue-950/80"
|
||||
/>
|
||||
@@ -287,7 +286,6 @@ export default function SignUpForm({
|
||||
alt="RentalDriveGo"
|
||||
width={104}
|
||||
height={104}
|
||||
priority
|
||||
unoptimized
|
||||
className="h-24 w-24 rounded-[1.75rem] border border-stone-200/80 bg-white/85 p-1.5 shadow-sm transition-colors dark:border-blue-800 dark:bg-blue-950/80"
|
||||
/>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useSearchParams } from 'next/navigation'
|
||||
import Image from 'next/image'
|
||||
import PublicShell from '@/components/layout/PublicShell'
|
||||
import { useDashboardI18n } from '@/components/I18nProvider'
|
||||
import { API_BASE } from '@/lib/api'
|
||||
import { resolveApiBase } from '@/lib/api'
|
||||
|
||||
export default function VerifyEmailPage() {
|
||||
const { language } = useDashboardI18n()
|
||||
@@ -45,7 +45,7 @@ export default function VerifyEmailPage() {
|
||||
|
||||
async function verify() {
|
||||
try {
|
||||
const url = `${API_BASE}/auth/employee/verify-email`
|
||||
const url = `${resolveApiBase()}/auth/employee/verify-email`
|
||||
const res = await fetch(url, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
@@ -93,7 +93,6 @@ export default function VerifyEmailPage() {
|
||||
alt="RentalDriveGo"
|
||||
width={80}
|
||||
height={80}
|
||||
priority
|
||||
unoptimized
|
||||
className="h-20 w-20 rounded-[1.5rem] border border-stone-200/80 bg-white/85 p-1.5 shadow-sm dark:border-blue-800 dark:bg-blue-950/80"
|
||||
/>
|
||||
|
||||
@@ -102,7 +102,6 @@ export default function PublicHeader({
|
||||
alt="RentalDriveGo"
|
||||
width={36}
|
||||
height={36}
|
||||
priority
|
||||
unoptimized
|
||||
className="h-8 w-8 rounded-md object-contain sm:h-9 sm:w-9"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user