ref(frontend): add ~/const path

This commit is contained in:
이강준
2022-11-27 16:12:25 +09:00
parent 2729b409e6
commit 66d2a2724e
59 changed files with 1077 additions and 1086 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import checkAuth from "~/pages/api/auth/CheckAuth";
import { publicPaths } from "../const";
import { publicPaths } from "~/const";
// #TODO: finish spinner only when the data loads fully
// #TODO: Redirect somewhere if the page does not exist
@@ -1,6 +1,6 @@
import token from "~/pages/api/auth/Token";
import { PATH } from "../../const";
import { PATH } from "~/const";
export default class SecurityClient {
static authOrigins = [PATH];
+3
View File
@@ -8,6 +8,9 @@
"~/utilities/*": [
"components/utilities/*"
],
"~/*": [
"const"
],
"~/pages/*": [
"pages/*"
],
+1 -1
View File
@@ -7,7 +7,7 @@ import Layout from "~/components/basic/layout";
import RouteGuard from "~/components/RouteGuard";
import { ENV } from "~/utilities/config";
import { publicPaths } from "../const.js";
import { publicPaths } from "~/const";
import "@fortawesome/fontawesome-svg-core/styles.css";
import "../styles/globals.css";
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This is the second step of the change password process (pake)
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient.js";
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
/**
* This function is used to check if the user is authenticated.
@@ -1,4 +1,4 @@
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
/**
* This route check the verification code from the email that user just recieved
@@ -1,4 +1,4 @@
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function is called in the end of the signup process.
@@ -26,13 +26,13 @@ const completeAccountInformationSignup = ({
tag,
salt,
verifier,
token
token,
}) => {
return fetch(PATH + "/api/v1/signup/complete-account/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
Authorization: "Bearer " + token,
},
body: JSON.stringify({
email,
@@ -1,4 +1,4 @@
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function is called in the end of the signup process.
@@ -24,13 +24,13 @@ const completeAccountInformationSignupInvite = ({
tag,
salt,
verifier,
token
token,
}) => {
return fetch(PATH + "/api/v1/signup/complete-account/invite", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
Authorization: "Bearer " + token,
},
body: JSON.stringify({
email: email,
@@ -41,7 +41,7 @@ const completeAccountInformationSignupInvite = ({
iv: iv,
tag: tag,
salt: salt,
verifier: verifier
verifier: verifier,
}),
});
};
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This is the route that issues a backup private key that will afterwards be added into a pdf
+1 -1
View File
@@ -1,4 +1,4 @@
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
/**
* This is the first step of the login process (pake)
+4 -5
View File
@@ -1,4 +1,4 @@
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This is the second step of the login process
@@ -16,16 +16,15 @@ const login2 = (email, clientProof) => {
email: email,
clientProof,
}),
credentials: "include"
})
.then(res => {
credentials: "include",
}).then((res) => {
if (res.status == 200) {
console.log("User logged in", res);
return res;
} else {
console.log("Failed to log in");
}
})
});
};
export default login2;
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route logs the user out. Note: the user should authorized to do this.
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This is the first step of the change password process (pake)
@@ -1,4 +1,4 @@
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
/**
* This route send the verification email to the user's email (contains a 6-digit verification code)
+5 -6
View File
@@ -1,4 +1,4 @@
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
const token = async (req, res) => {
return fetch(PATH + "/api/v1/auth/token", {
@@ -6,15 +6,14 @@ const token = async (req, res) => {
headers: {
"Content-Type": "application/json",
},
credentials: "include"
})
.then(async res => {
credentials: "include",
}).then(async (res) => {
if (res.status == 200) {
return (await res.json()).token;
} else {
console.log('Getting a new token failed');
console.log("Getting a new token failed");
}
})
});
};
export default token;
@@ -1,4 +1,4 @@
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route verifies the signup invite link
@@ -1,4 +1,4 @@
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
/**
* This route lets us get the public key of infisical. Th euser doesn't have to be authenticated since this is just the public key.
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient.js";
import { PATH } from "../../../const.js";
import { PATH } from "~/const";
/**
* This function fetches the encrypted secrets from the .env file
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function uploads the encrypted .env file
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
const changeHerokuConfigVars = ({ integrationId, key, secrets }) => {
return SecurityClient.fetchCall(
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route deletes an integration from a certain project
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route deletes an integration authorization from a certain project
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
const getIntegrationApps = ({ integrationAuthId }) => {
return SecurityClient.fetchCall(
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
const getIntegrations = () => {
return SecurityClient.fetchCall(PATH + "/api/v1/integration/integrations", {
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route starts the integration after teh default one if gonna set up.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This is the first step of the change password process (pake)
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route gets authorizations of a certain project (Heroku, etc.)
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route gets integrations of a certain project (Heroku, etc.)
+3 -6
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get info about a certain org
@@ -9,15 +9,12 @@ import { PATH } from "../../../const";
* @returns
*/
const getOrganization = (req, res) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId,
{
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
}).then(async (res) => {
if (res.status == 200) {
return (await res.json()).organization;
} else {
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get all the users in an org.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get the current subscription of an org.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get all the projects of a certain user in an org.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get all the users in an org.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route redirects the user to the right stripe billing page.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route add an incident contact email to a certain organization
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function sends an email invite to a user to join an org
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route deletes an incident Contact from a certain organization
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function removes a certain member from a certain organization
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This routes gets all the incident contacts of a certain organization
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get the all the orgs of a certain user.
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us rename a certain org.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route gets service tokens for a specific user in a project
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route gets service tokens for a specific user in a project
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route gets the information about a specific user.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route registers a certain action for a user
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route registers a certain action for a user
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function adds a user to a project
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function change the access of a user in a certain workspace
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route creates a new workspace for a user.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This function removes a certain member from a certain workspace
@@ -8,15 +8,12 @@ import { PATH } from "../../../const";
* @returns
*/
const deleteUserFromWorkspace = (membershipId) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/membership/" + membershipId,
{
return SecurityClient.fetchCall(PATH + "/api/v1/membership/" + membershipId, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
}).then(async (res) => {
if (res.status == 200) {
return res;
} else {
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route deletes a specified workspace.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* Get the latest key pairs from a certain workspace
@@ -20,9 +20,7 @@ const getLatestFileKey = (workspaceId) => {
if (res.status == 200) {
return await res.json();
} else {
console.log(
"Failed to get the latest key pairs for a certain project"
);
console.log("Failed to get the latest key pairs for a certain project");
}
});
};
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get the information of a certain project.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get the public keys of everyone in your workspace.
@@ -21,9 +21,7 @@ const getWorkspaceKeys = (req, res) => {
if (res.status == 200) {
return (await res.json()).publicKeys;
} else {
console.log(
"Failed to get the public keys of everyone in the workspace"
);
console.log("Failed to get the public keys of everyone in the workspace");
}
});
};
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get all the users in the workspace.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us get the public keys of everyone in your workspace.
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route lets us rename a certain workspace.
+1 -1
View File
@@ -1,6 +1,6 @@
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
import { PATH } from "~/const";
/**
* This route uplods the keys in an encrypted format.