I-36 Remove dependency to PATH const

This commit is contained in:
Reginald Bondoc
2022-11-30 23:39:23 +01:00
parent f9bf418bf8
commit d8aa5b5ff4
57 changed files with 54 additions and 125 deletions
+1 -2
View File
@@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@@ -14,7 +13,7 @@ const changePassword2 = ({
verifier,
clientProof,
}) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/change-password", {
return SecurityClient.fetchCall("/api/v1/password/change-password", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -2
View File
@@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient.js";
/**
@@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient.js";
* @returns
*/
const checkAuth = async (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/auth/checkAuth", {
return SecurityClient.fetchCall("/api/v1/auth/checkAuth", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This route check the verification code from the email that user just recieved
* @param {*} email
@@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const checkEmailVerificationCode = (email, code) => {
return fetch(PATH + "/api/v1/signup/email/verify", {
return fetch("/api/v1/signup/email/verify", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This function is called in the end of the signup process.
* It sends all the necessary nformation to the server.
@@ -28,7 +26,7 @@ const completeAccountInformationSignup = ({
verifier,
token,
}) => {
return fetch(PATH + "/api/v1/signup/complete-account/signup", {
return fetch("/api/v1/signup/complete-account/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This function is called in the end of the signup process.
* It sends all the necessary nformation to the server.
@@ -26,7 +24,7 @@ const completeAccountInformationSignupInvite = ({
verifier,
token,
}) => {
return fetch(PATH + "/api/v1/signup/complete-account/invite", {
return fetch("/api/v1/signup/complete-account/invite", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@@ -13,7 +12,7 @@ const issueBackupPrivateKey = ({
clientProof,
}) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/password/backup-private-key",
"/api/v1/password/backup-private-key",
{
method: "POST",
headers: {
+1 -3
View File
@@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This is the first step of the login process (pake)
* @param {*} email
@@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const login1 = (email, clientPublicKey) => {
return fetch(PATH + "/api/v1/auth/login1", {
return fetch("/api/v1/auth/login1", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -3
View File
@@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This is the second step of the login process
* @param {*} email
@@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const login2 = (email, clientProof) => {
return fetch(PATH + "/api/v1/auth/login2", {
return fetch("/api/v1/auth/login2", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -2
View File
@@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@@ -9,7 +8,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const logout = async (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/auth/logout", {
return SecurityClient.fetchCall("/api/v1/auth/logout", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -2
View File
@@ -1,4 +1,3 @@
import { PATH } from "~/const";
import SecurityClient from "~/utilities/SecurityClient";
/**
@@ -7,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* @returns
*/
const SRP1 = ({ clientPublicKey }) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/srp1", {
return SecurityClient.fetchCall("/api/v1/password/srp1", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,11 +1,9 @@
import { PATH } from "~/const";
/**
* This route send the verification email to the user's email (contains a 6-digit verification code)
* @param {*} email
*/
const sendVerificationEmail = (email) => {
fetch(PATH + "/api/v1/signup/email/signup", {
fetch("/api/v1/signup/email/signup", {
method: "POST",
headers: {
"Content-Type": "application/json",
+1 -3
View File
@@ -1,7 +1,5 @@
import { PATH } from "~/const";
const token = async (req, res) => {
return fetch(PATH + "/api/v1/auth/token", {
return fetch("/api/v1/auth/token", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,5 +1,3 @@
import { PATH } from "~/const";
/**
* This route verifies the signup invite link
* @param {*} email
@@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const verifySignupInvite = ({ email, code }) => {
return fetch(PATH + "/api/v1/invite-org/verify", {
return fetch("/api/v1/invite-org/verify", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -1,5 +1,3 @@
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.
* @param {*} req
@@ -7,7 +5,7 @@ import { PATH } from "~/const";
* @returns
*/
const publicKeyInfisical = (req, res) => {
return fetch(PATH + "/api/v1/key/publicKey/infisical", {
return fetch("/api/v1/key/publicKey/infisical", {
method: "GET",
headers: {
"Content-Type": "application/json",