diff --git a/.env.test b/.env.test index 6a513e6..52a165f 100644 --- a/.env.test +++ b/.env.test @@ -10,26 +10,13 @@ NEXTAUTH_SECRET=1dd8a5457970d1dda50600be28e935ecc4513ff27c49c431849e6746f158d638 # ? do we need to duplicate this? already defined in the deoployment yml file DATABASE=mysql://jwpwsofia_demo:dwxhns9p9vp248@mariadb:3306/jwpwsofia_demo -APPLE_ID= -APPLE_TEAM_ID= -APPLE_PRIVATE_KEY= -APPLE_KEY_ID= - AUTH0_ID=Aa9f3HJowauUrmBVY4iQzQJ7fYsaZDbK AUTH0_SECRET=_c0O9GkyRXkoWMQW7jNExnl6UoXN6O4oD3mg7NZ_uHVeAinCUtcTAkeQmcKXpZ4x AUTH0_ISSUER=https://dev-wkzi658ckibr1amv.us.auth0.com -FACEBOOK_ID= -FACEBOOK_SECRET= - -GITHUB_ID= -GITHUB_SECRET= # GOOGLE_ID=926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com # GOOGLE_SECRET=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 -TWITTER_ID= -TWITTER_SECRET= - MAILTRAP_HOST_BULK=bulk.smtp.mailtrap.io MAILTRAP_HOST=live.smtp.mailtrap.io MAILTRAP_USER=api diff --git a/components/location/LocationForm.js b/components/location/LocationForm.js index 4f58fdb..be36371 100644 --- a/components/location/LocationForm.js +++ b/components/location/LocationForm.js @@ -7,7 +7,7 @@ import DayOfWeek from "../DayOfWeek"; import TextEditor from "../TextEditor"; import FileUploadWithPreview from 'components/FileUploadWithPreview '; -import ProtectedRoute, { serverSideAuth } from "../..//components/protectedRoute"; +import ProtectedRoute, { serverSideAuth } from "../../components/protectedRoute"; import { UserRole } from "@prisma/client"; const common = require('src/helpers/common'); diff --git a/components/publisher/PublisherCard.js b/components/publisher/PublisherCard.js index 248f067..c43025d 100644 --- a/components/publisher/PublisherCard.js +++ b/components/publisher/PublisherCard.js @@ -5,6 +5,7 @@ import { useEffect, useState } from 'react' import toast from "react-hot-toast"; import axiosInstance from '../../src/axiosSecure'; +import ProtectedRoute, { serverSideAuth } from "../../components/protectedRoute"; //add months to date. works with negative numbers and numbers > 12 export function addMonths(numOfMonths, date) { @@ -53,6 +54,23 @@ export default function PublisherCard({ publisher }) { console.log(JSON.stringify(error)); } }; + const handleLoginAs = async (userId) => { + const response = await fetch('/api/auth/login-as', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ userId }), + }); + + if (response.ok) { + const data = await response.json(); + // Assuming you have some context or state management to update the session + updateSession(data.session); + } else { + alert("Failed to impersonate user."); + } + }; return isCardVisible ? ( // className="block p-6 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-700 dark:hover:bg-gray-700 mb-3" @@ -89,6 +107,10 @@ export default function PublisherCard({ publisher }) { */} + + + +