Update process env.

This commit is contained in:
Patrick Fic
2021-10-13 13:22:56 -07:00
parent 661b05d9e3
commit 944229bae3

View File

@@ -18,6 +18,16 @@ const oauthClient = new OAuthClient({
logging: true, logging: true,
}); });
let url;
if (process.env.NODE_ENV === "production") {
url = `https://imex.online`;
} else if (process.env.NODE_ENV === "test") {
url = `https://test.imex.online`;
} else {
url = `http://localhost:3000`;
}
exports.default = async (req, res) => { exports.default = async (req, res) => {
const params = queryString.parse(req.url.split("?").reverse()[0]); const params = queryString.parse(req.url.split("?").reverse()[0]);
try { try {
@@ -28,7 +38,7 @@ exports.default = async (req, res) => {
error: authResponse.json, error: authResponse.json,
}); });
res.redirect( res.redirect(
`http://localhost:3000/manage/accounting/qbo?error=${encodeURIComponent( `${url}:3000/manage/accounting/qbo?error=${encodeURIComponent(
JSON.stringify(authResponse.json) JSON.stringify(authResponse.json)
)}` )}`
); );
@@ -46,9 +56,7 @@ exports.default = async (req, res) => {
); );
res.redirect( res.redirect(
`http://localhost:3000/manage/accounting/qbo?${queryString.stringify( `${url}:3000/manage/accounting/qbo?${queryString.stringify(params)}`
params
)}`
); );
} }
} catch (e) { } catch (e) {