Merge pull request #319 from groombook/fix/gro-749-portal-auth-header

fix(GRO-749): use correct impersonation header in portal Appointments
This commit was merged in pull request #319.
This commit is contained in:
the-dogfather-cto[bot]
2026-04-17 12:23:43 +00:00
committed by GitHub
2 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -93,7 +93,7 @@ describe("CustomerNotesSection", () => {
"/api/portal/appointments/appt-1/notes", "/api/portal/appointments/appt-1/notes",
expect.objectContaining({ expect.objectContaining({
headers: expect.objectContaining({ headers: expect.objectContaining({
"Authorization": "Bearer test-session-id", "X-Impersonation-Session-Id": "test-session-id",
}), }),
}) })
); );
@@ -269,7 +269,7 @@ describe("ConfirmationSection", () => {
"/api/portal/appointments/appt-1/confirm", "/api/portal/appointments/appt-1/confirm",
expect.objectContaining({ expect.objectContaining({
headers: expect.objectContaining({ headers: expect.objectContaining({
"Authorization": "Bearer test-session-id", "X-Impersonation-Session-Id": "test-session-id",
}), }),
}) })
); );
@@ -379,7 +379,7 @@ export function ConfirmationSection({
try { try {
const headers: Record<string, string> = {}; const headers: Record<string, string> = {};
if (sessionId) { if (sessionId) {
headers['Authorization'] = `Bearer ${sessionId}`; headers['X-Impersonation-Session-Id'] = sessionId ?? '';
} }
const res = await fetch(`/api/portal/appointments/${appt.id}/confirm`, { const res = await fetch(`/api/portal/appointments/${appt.id}/confirm`, {
method: 'POST', method: 'POST',
@@ -455,7 +455,7 @@ function CancelAppointmentButton({
try { try {
const headers: Record<string, string> = {}; const headers: Record<string, string> = {};
if (sessionId) { if (sessionId) {
headers['Authorization'] = `Bearer ${sessionId}`; headers['X-Impersonation-Session-Id'] = sessionId ?? '';
} }
const res = await fetch(`/api/portal/appointments/${appt.id}/cancel`, { const res = await fetch(`/api/portal/appointments/${appt.id}/cancel`, {
method: 'POST', method: 'POST',
@@ -507,7 +507,7 @@ export function CustomerNotesSection({
try { try {
const headers: Record<string, string> = { 'Content-Type': 'application/json' }; const headers: Record<string, string> = { 'Content-Type': 'application/json' };
if (sessionId) { if (sessionId) {
headers['Authorization'] = `Bearer ${sessionId}`; headers['X-Impersonation-Session-Id'] = sessionId ?? '';
} }
const res = await fetch(`/api/portal/appointments/${appt.id}/notes`, { const res = await fetch(`/api/portal/appointments/${appt.id}/notes`, {
method: 'PATCH', method: 'PATCH',
@@ -600,7 +600,7 @@ export function RescheduleFlow({
setError(null); setError(null);
try { try {
const headers: Record<string, string> = { 'Content-Type': 'application/json' }; const headers: Record<string, string> = { 'Content-Type': 'application/json' };
if (sessionId) headers['Authorization'] = `Bearer ${sessionId}`; if (sessionId) headers['X-Impersonation-Session-Id'] = sessionId ?? '';
const res = await fetch(`/api/portal/appointments/${appt.id}/reschedule`, { const res = await fetch(`/api/portal/appointments/${appt.id}/reschedule`, {
method: 'POST', method: 'POST',
headers, headers,
@@ -784,7 +784,7 @@ function BookingFlow({ onClose, sessionId }: BookingFlowProps) {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Bearer ${sessionId}`, 'X-Impersonation-Session-Id': sessionId ?? '',
}, },
body: JSON.stringify({ body: JSON.stringify({
petId: selectedPet.id, petId: selectedPet.id,