rename PUBLIC_URL to NEXT_PUBLIC_PUBLIC_URL

This commit is contained in:
Dobromir Popov
2024-04-02 02:04:45 +03:00
parent 31ad2bf997
commit 8117a74a09
15 changed files with 21 additions and 21 deletions

View File

@ -24,7 +24,7 @@ import { isLoggedIn, setAuthTokens, clearAuthTokens, getAccessToken, getRefreshT
export const authOptions: NextAuthOptions = { export const authOptions: NextAuthOptions = {
// https://next-auth.js.org/configuration/providers/oauth // https://next-auth.js.org/configuration/providers/oauth
site: process.env.PUBLIC_URL, site: process.env.NEXT_PUBLIC_PUBLIC_URL,
secret: process.env.NEXTAUTH_SECRET, // Ensure you have this set in your .env file secret: process.env.NEXTAUTH_SECRET, // Ensure you have this set in your .env file
//adapter: PrismaAdapter(prisma), //adapter: PrismaAdapter(prisma),
providers: [ providers: [

View File

@ -444,7 +444,7 @@ async function GenerateSchedule(axios: Axios, date: string, copyFromPreviousMont
} }
//create shifts using API //create shifts using API
// const { data: createdShifts } = await axios.post(`${process.env.PUBLIC_URL}/api/data/shifts`, shiftsToCreate); // const { data: createdShifts } = await axios.post(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/shifts`, shiftsToCreate);
//const { data: allshifts } = await axios.get(`/api/data/shifts`); //const { data: allshifts } = await axios.get(`/api/data/shifts`);
return {}; //allshifts; return {}; //allshifts;

View File

@ -133,7 +133,7 @@ export const getServerSideProps = async (context) => {
const role = session?.user.role; const role = session?.user.role;
console.log("server role: " + role); console.log("server role: " + role);
var queryUrl = process.env.PUBLIC_URL + "/api/data/availabilities?select=id,name,isActive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id"; var queryUrl = process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/availabilities?select=id,name,isActive,dayofweek,dayOfMonth,startTime,endTime,publisher.firstName,publisher.lastName,publisher.id";
if (role === UserRole.USER || context.query.my) { if (role === UserRole.USER || context.query.my) {
queryUrl += `&where={"publisherId":"${session?.user.id}"}`; queryUrl += `&where={"publisherId":"${session?.user.id}"}`;
} else if (role == UserRole.ADMIN) { } else if (role == UserRole.ADMIN) {
@ -145,7 +145,7 @@ export const getServerSideProps = async (context) => {
} }
var resp = await axios.get( var resp = await axios.get(
queryUrl queryUrl
// process.env.PUBLIC_URL + "/api/data/availabilities?include=publisher", // process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/availabilities?include=publisher",
, { decompress: true }); , { decompress: true });
var items = resp.data; var items = resp.data;
console.log("got " + items.length + " availabilities"); console.log("got " + items.length + " availabilities");

View File

@ -31,7 +31,7 @@ export const getServerSideProps = async (context) => {
}; };
} }
const { data: item } = await axios.get( const { data: item } = await axios.get(
process.env.PUBLIC_URL + "/api/data/availabilities/" + context.params.id process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/availabilities/" + context.params.id
); );
return { return {

View File

@ -891,9 +891,9 @@ import axiosServer from '../../../src/axiosServer';
import { start } from 'repl'; import { start } from 'repl';
export const getServerSideProps = async (context) => { export const getServerSideProps = async (context) => {
const axios = await axiosServer(context); const axios = await axiosServer(context);
const baseUrl = common.getBaseUrl(); // const baseUrl = common.getBaseUrl();
console.log('runtime BaseUrl: ' + baseUrl); // console.log('runtime BaseUrl: ' + baseUrl);
console.log('runtime PUBLIC_URL: ' + process.env.PUBLIC_URL); console.log('runtime NEXT_PUBLIC_PUBLIC_URL: ' + process.env.NEXT_PUBLIC_PUBLIC_URL);
console.log('Runtime Axios Base URL:', axios.defaults.baseURL); console.log('Runtime Axios Base URL:', axios.defaults.baseURL);
const currentDate = new Date(); const currentDate = new Date();

View File

@ -7,9 +7,9 @@ export const getServerSideProps = async (context) => {
console.log("edit page getServerSideProps"); console.log("edit page getServerSideProps");
const axios = await axiosServer(context); const axios = await axiosServer(context);
const { id } = context.query; const { id } = context.query;
const { data } = await axios.get(`${process.env.PUBLIC_URL}/api/data/cartevents/` + id); const { data } = await axios.get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/cartevents/` + id);
const locations = await axios const locations = await axios
.get(`${process.env.PUBLIC_URL}/api/data/locations?select=id,name`) .get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations?select=id,name`)
.then((res) => { .then((res) => {
console.log("locations: " + JSON.stringify(res.data)); console.log("locations: " + JSON.stringify(res.data));
return res.data; return res.data;

View File

@ -26,7 +26,7 @@ export const getServerSideProps = async (context) => {
const axios = await axiosServer(context); const axios = await axiosServer(context);
const locations = await axios const locations = await axios
.get(`${process.env.PUBLIC_URL}/api/data/locations?select=id,name`) .get(`${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations?select=id,name`)
.then((res) => { .then((res) => {
console.log("locations: " + JSON.stringify(res.data)); console.log("locations: " + JSON.stringify(res.data));
return res.data; return res.data;
@ -41,7 +41,7 @@ export const getServerSideProps = async (context) => {
const { id } = context.query.id; const { id } = context.query.id;
const { data: item } = await axiosInstance.get( const { data: item } = await axiosInstance.get(
process.env.PUBLIC_URL + "/api/data/cartevents/" + context.params.id process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/cartevents/" + context.params.id
); );
return { return {

View File

@ -99,11 +99,11 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
const axios = await axiosServer(context); const axios = await axiosServer(context);
const { data: location } = await axios.get( const { data: location } = await axios.get(
`${process.env.PUBLIC_URL}/api/data/locations/${context.params.id}` `${process.env.NEXT_PUBLIC_PUBLIC_URL}/api/data/locations/${context.params.id}`
); );
if (location.backupLocationId !== null) { if (location.backupLocationId !== null) {
const { data: backupLocation } = await axios.get( const { data: backupLocation } = await axios.get(
process.env.PUBLIC_URL + "/api/data/locations/" + location.backupLocationId process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/locations/" + location.backupLocationId
); );
location.backupLocationName = backupLocation.name; location.backupLocationName = backupLocation.name;
location.backupLocationContent = backupLocation ? backupLocation.content : ""; location.backupLocationContent = backupLocation ? backupLocation.content : "";

View File

@ -29,7 +29,7 @@ export const getServerSideProps = async (context) => {
}; };
} }
const { data: item } = await axios.get( const { data: item } = await axios.get(
process.env.PUBLIC_URL + "/api/data/locations/" + context.params.id process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/locations/" + context.params.id
); );
console.log(item) //this is the location object console.log(item) //this is the location object
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate"); context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");

View File

@ -32,7 +32,7 @@ export const getServerSideProps = async (context) => {
} }
const { data: loc } = await axios.get( const { data: loc } = await axios.get(
`${process.env.PUBLIC_URL}api/data/locations/` + context.params.id `${process.env.NEXT_PUBLIC_PUBLIC_URL}api/data/locations/` + context.params.id
); );
console.log(location) //this is the location object console.log(location) //this is the location object
context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate"); context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");

View File

@ -44,7 +44,7 @@ export const getServerSideProps = async (context) => {
props: {} props: {}
}; };
} }
var url = process.env.PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,assignments,assignments.shift"; var url = process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,assignments,assignments.shift";
console.log("GET PUBLISHER FROM:" + url) console.log("GET PUBLISHER FROM:" + url)
const { data: item } = await axios.get(url); const { data: item } = await axios.get(url);

View File

@ -47,7 +47,7 @@ export const getServerSideProps = async (context) => {
props: {} props: {}
}; };
} }
var url = process.env.PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,shifts"; var url = process.env.NEXT_PUBLIC_PUBLIC_URL + "/api/data/publishers/" + context.query.id + "?include=availabilities,shifts";
console.log("GET PUBLISHER FROM:" + url) console.log("GET PUBLISHER FROM:" + url)
const { data } = await axios.get(url); const { data } = await axios.get(url);

View File

@ -32,7 +32,7 @@ export const getServerSideProps = async (context) => {
// }; // };
// } // }
// const { data: loc } = await axiosInstance.get( // const { data: loc } = await axiosInstance.get(
// `${process.env.PUBLIC_URL}api/data/locations/` + context.params.id // `${process.env.NEXT_PUBLIC_PUBLIC_URL}api/data/locations/` + context.params.id
// ); // );
// console.log(location) //this is the location object // console.log(location) //this is the location object

View File

@ -33,7 +33,7 @@ export const getServerSideProps = async (context) => {
// } // }
// const { data: loc } = await axiosInstance.get( // const { data: loc } = await axiosInstance.get(
// `${process.env.PUBLIC_URL}api/data/locations/` + context.params.id // `${process.env.NEXT_PUBLIC_PUBLIC_URL}api/data/locations/` + context.params.id
// ); // );
// console.log(location) //this is the location object // console.log(location) //this is the location object
// context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate"); // context.res.setHeader("Cache-Control", "s-maxage=1, stale-while-revalidate");

View File

@ -43,7 +43,7 @@ const dev = process.env.NODE_ENV !== "production";
const nextApp = next({ dev }); const nextApp = next({ dev });
const nextHandler = nextApp.getRequestHandler(); const nextHandler = nextApp.getRequestHandler();
console.log("process.env.PROTOCOL = ", process.env.PROTOCOL); console.log("process.env.PROTOCOL = ", process.env.PROTOCOL);
console.log("process.env.PUBLIC_URL = ", process.env.NEXT_PUBLIC_PUBLIC_URL); console.log("process.env.NEXT_PUBLIC_PUBLIC_URL = ", process.env.NEXT_PUBLIC_PUBLIC_URL);
console.log("process.env.PORT = ", process.env.PORT); console.log("process.env.PORT = ", process.env.PORT);
console.log("process.env.TELEGRAM_BOT = ", process.env.TELEGRAM_BOT); console.log("process.env.TELEGRAM_BOT = ", process.env.TELEGRAM_BOT);