E2E port & process.env usecases

This commit is contained in:
Aarni Halinen
2021-01-15 11:51:10 +02:00
parent 9b6498c6c9
commit 2ec3f2adf8
4 changed files with 439 additions and 933 deletions
+430 -925
View File
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -26,10 +26,11 @@
"lint:es:fix": "eslint --fix \"./src/**/*.{ts,tsx}\"",
"lint:css": "stylelint \"./src/**/*.{ts,tsx}\"",
"start": "next dev",
"start-prod": "next start",
"start-prod": "next start --port ${SERVER_PORT:=80}",
"serve": "next start --port 3000",
"test": "npm run test:e2e:verbose",
"test:e2e": "npm-run-all -p -r start-prod testcafe",
"test:e2e:verbose": "npm-run-all -p -r start-prod testcafe:verbose",
"test:e2e": "npm-run-all -p -r serve testcafe",
"test:e2e:verbose": "npm-run-all -p -r serve testcafe:verbose",
"testcafe": "testcafe -S -s 'e2e-screenshots' --app-init-delay 2000 chrome:headless tests/testcafe",
"testcafe:verbose": "testcafe -S -s 'e2e-screenshots' --app-init-delay 2000 chrome tests/testcafe"
},
@@ -61,7 +62,6 @@
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-standard": "^5.0.0",
"express": "4.17.0",
"favicons-webpack-plugin": "4.2.0",
"helmet": "3.21.2",
"husky": "1.3.1",
"morgan": "1.9.1",
@@ -79,6 +79,7 @@
"dependencies": {
"axios": "0.19.0",
"date-fns": "2.0.0-alpha.27",
"favicons-webpack-plugin": "4.2.0",
"js-cookie": "2.2.0",
"lodash": "4.17.20",
"next": "10.0.5",
+2 -2
View File
@@ -96,7 +96,7 @@ export async function deleteForm(id: number) {
export const signupFormSendEmail = async (data, id): Promise<any> => {
try {
const resp = await axios.post(`${process.env.NEXT_PUBLIC_API_URL}/signupForm/${id}/sendemail/`, data, {
const resp = await axios.post(`${URL}${id}/sendemail/`, data, {
headers: {
"Authorization": getAuthHeader(),
},
@@ -110,7 +110,7 @@ export const signupFormSendEmail = async (data, id): Promise<any> => {
export const getSignups = async (id): Promise<Signup[]> => {
try {
const resp = await axios.get(`${process.env.NEXT_PUBLIC_API_URL}/signupForm/${id}/signups/`, {
const resp = await axios.get(`${URL}${id}/signups/`, {
headers: {
"Authorization": getAuthHeader(),
},
+2 -2
View File
@@ -19,7 +19,7 @@ export async function generateToken(username: string, password: string): Promise
export function setTokenCookie(token: string) {
Cookies.set("jwt", token);
Cookies.set("jwt", token, { domain: ".sika.sik.party" });
Cookies.set("jwt", token, { domain: ".sik.party" });
}
export function getTokenCookie(): string {
@@ -27,7 +27,7 @@ export function getTokenCookie(): string {
}
export function deleteTokenCookie(): void {
Cookies.remove("jwt", { domain: ".sika.sik.party" });
Cookies.remove("jwt", { domain: ".sik.party" });
Cookies.remove("jwt");
}