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 { useEffect, useState } from 'react'
|
||||||
import { formatCurrency } from '@rentaldrivego/types'
|
import { formatCurrency } from '@rentaldrivego/types'
|
||||||
import { API_BASE, apiFetch } from '@/lib/api'
|
import { apiFetch, resolveApiBase } from '@/lib/api'
|
||||||
import { useDashboardI18n } from '@/components/I18nProvider'
|
import { useDashboardI18n } from '@/components/I18nProvider'
|
||||||
|
|
||||||
interface ReportRow {
|
interface ReportRow {
|
||||||
@@ -110,7 +110,7 @@ export default function ReportsPage() {
|
|||||||
setExporting(true)
|
setExporting(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
try {
|
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',
|
credentials: 'include',
|
||||||
})
|
})
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Link from "next/link";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useDashboardI18n } from "@/components/I18nProvider";
|
import { useDashboardI18n } from "@/components/I18nProvider";
|
||||||
import PublicShell from "@/components/layout/PublicShell";
|
import PublicShell from "@/components/layout/PublicShell";
|
||||||
import { API_BASE } from "@/lib/api";
|
import { resolveApiBase } from "@/lib/api";
|
||||||
import { carplaceUrl } from "@/lib/urls";
|
import { carplaceUrl } from "@/lib/urls";
|
||||||
|
|
||||||
const DASHBOARD_LOGO_SRC = "/dashboard/rentaldrivego.png";
|
const DASHBOARD_LOGO_SRC = "/dashboard/rentaldrivego.png";
|
||||||
@@ -69,14 +69,15 @@ export default function ForgotPasswordPageClient({
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
setError(null);
|
setError(null);
|
||||||
try {
|
try {
|
||||||
|
const apiBase = resolveApiBase();
|
||||||
// Try employee first, then admin — mirrors the sign-in page which handles both
|
// Try employee first, then admin — mirrors the sign-in page which handles both
|
||||||
const [empRes, adminRes] = await Promise.all([
|
const [empRes, adminRes] = await Promise.all([
|
||||||
fetch(`${API_BASE}/auth/employee/forgot-password`, {
|
fetch(`${apiBase}/auth/employee/forgot-password`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ email }),
|
body: JSON.stringify({ email }),
|
||||||
}),
|
}),
|
||||||
fetch(`${API_BASE}/admin/auth/forgot-password`, {
|
fetch(`${apiBase}/admin/auth/forgot-password`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ email }),
|
body: JSON.stringify({ email }),
|
||||||
@@ -103,7 +104,6 @@ export default function ForgotPasswordPageClient({
|
|||||||
alt="RentalDriveGo"
|
alt="RentalDriveGo"
|
||||||
width={104}
|
width={104}
|
||||||
height={104}
|
height={104}
|
||||||
priority
|
|
||||||
unoptimized
|
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"
|
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 { useSearchParams } from 'next/navigation'
|
||||||
import { useDashboardI18n } from '@/components/I18nProvider'
|
import { useDashboardI18n } from '@/components/I18nProvider'
|
||||||
import PublicShell from '@/components/layout/PublicShell'
|
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 }) {
|
export default function ResetPasswordPageClient({ embedded = false }: { embedded?: boolean }) {
|
||||||
return (
|
return (
|
||||||
@@ -92,7 +92,7 @@ function ResetPasswordContent({ embedded = false }: { embedded?: boolean }) {
|
|||||||
setLoading(true)
|
setLoading(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${API_BASE}/auth/employee/reset-password`, {
|
const res = await fetch(`${resolveApiBase()}/auth/employee/reset-password`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ token, password }),
|
body: JSON.stringify({ token, password }),
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|||||||
import { useDashboardI18n } from "@/components/I18nProvider";
|
import { useDashboardI18n } from "@/components/I18nProvider";
|
||||||
import PublicShell from "@/components/layout/PublicShell";
|
import PublicShell from "@/components/layout/PublicShell";
|
||||||
import { adminUrl, websiteUrl } from "@/lib/urls";
|
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";
|
import { toPublicDashboardPath } from "@/lib/dashboardPaths";
|
||||||
|
|
||||||
const DASHBOARD_LOGO_SRC = "/dashboard/rentaldrivego.png";
|
const DASHBOARD_LOGO_SRC = "/dashboard/rentaldrivego.png";
|
||||||
@@ -195,7 +195,6 @@ export default function SignInPageClient({
|
|||||||
alt="RentalDriveGo"
|
alt="RentalDriveGo"
|
||||||
width={104}
|
width={104}
|
||||||
height={104}
|
height={104}
|
||||||
priority
|
|
||||||
unoptimized
|
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"
|
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);
|
setCanResendVerification(false);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const apiBase = resolveApiBase();
|
||||||
|
|
||||||
const tryAdminLogin = async () => {
|
const tryAdminLogin = async () => {
|
||||||
const adminRes = await fetch(`${API_BASE}/admin/auth/login`, {
|
const adminRes = await fetch(`${apiBase}/admin/auth/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
@@ -307,7 +308,7 @@ function LocalSignInForm({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tryEmployeeLogin = async () => {
|
const tryEmployeeLogin = async () => {
|
||||||
const empRes = await fetch(`${API_BASE}/auth/employee/login`, {
|
const empRes = await fetch(`${apiBase}/auth/employee/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
@@ -379,7 +380,7 @@ function LocalSignInForm({
|
|||||||
setError(null);
|
setError(null);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${API_BASE}/auth/employee/resend-verification`, {
|
const res = await fetch(`${resolveApiBase()}/auth/employee/resend-verification`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
@@ -409,7 +410,7 @@ function LocalSignInForm({
|
|||||||
? { totpCode: normalizedCode }
|
? { totpCode: normalizedCode }
|
||||||
: { recoveryCode: normalizedCode };
|
: { recoveryCode: normalizedCode };
|
||||||
|
|
||||||
const adminRes = await fetch(`${API_BASE}/admin/auth/login`, {
|
const adminRes = await fetch(`${resolveApiBase()}/admin/auth/login`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
|
|||||||
@@ -249,7 +249,6 @@ export default function SignUpForm({
|
|||||||
alt="RentalDriveGo"
|
alt="RentalDriveGo"
|
||||||
width={104}
|
width={104}
|
||||||
height={104}
|
height={104}
|
||||||
priority
|
|
||||||
unoptimized
|
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"
|
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"
|
alt="RentalDriveGo"
|
||||||
width={104}
|
width={104}
|
||||||
height={104}
|
height={104}
|
||||||
priority
|
|
||||||
unoptimized
|
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"
|
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 Image from 'next/image'
|
||||||
import PublicShell from '@/components/layout/PublicShell'
|
import PublicShell from '@/components/layout/PublicShell'
|
||||||
import { useDashboardI18n } from '@/components/I18nProvider'
|
import { useDashboardI18n } from '@/components/I18nProvider'
|
||||||
import { API_BASE } from '@/lib/api'
|
import { resolveApiBase } from '@/lib/api'
|
||||||
|
|
||||||
export default function VerifyEmailPage() {
|
export default function VerifyEmailPage() {
|
||||||
const { language } = useDashboardI18n()
|
const { language } = useDashboardI18n()
|
||||||
@@ -45,7 +45,7 @@ export default function VerifyEmailPage() {
|
|||||||
|
|
||||||
async function verify() {
|
async function verify() {
|
||||||
try {
|
try {
|
||||||
const url = `${API_BASE}/auth/employee/verify-email`
|
const url = `${resolveApiBase()}/auth/employee/verify-email`
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
@@ -93,7 +93,6 @@ export default function VerifyEmailPage() {
|
|||||||
alt="RentalDriveGo"
|
alt="RentalDriveGo"
|
||||||
width={80}
|
width={80}
|
||||||
height={80}
|
height={80}
|
||||||
priority
|
|
||||||
unoptimized
|
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"
|
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"
|
alt="RentalDriveGo"
|
||||||
width={36}
|
width={36}
|
||||||
height={36}
|
height={36}
|
||||||
priority
|
|
||||||
unoptimized
|
unoptimized
|
||||||
className="h-8 w-8 rounded-md object-contain sm:h-9 sm:w-9"
|
className="h-8 w-8 rounded-md object-contain sm:h-9 sm:w-9"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user