ref(frontend): update to absolute import

This commit is contained in:
이강준
2022-11-26 18:19:41 +09:00
parent 001df70e26
commit 22c184840c
73 changed files with 2029 additions and 1287 deletions
+18 -12
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -6,28 +6,34 @@ import { PATH } from "../../../const";
* @param {*} clientPublicKey
* @returns
*/
const changePassword2 = ({encryptedPrivateKey, iv, tag, salt, verifier, clientProof}) => {
const changePassword2 = ({
encryptedPrivateKey,
iv,
tag,
salt,
verifier,
clientProof,
}) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/change-password", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"clientProof": clientProof,
"encryptedPrivateKey": encryptedPrivateKey,
"iv": iv,
"tag": tag,
"salt": salt,
"verifier": verifier
clientProof: clientProof,
encryptedPrivateKey: encryptedPrivateKey,
iv: iv,
tag: tag,
salt: salt,
verifier: verifier,
}),
})
.then(async res => {
}).then(async (res) => {
if (res.status == 200) {
return res;
} else {
console.log('Failed to change the password');
console.log("Failed to change the password");
}
})
});
};
export default changePassword2;
+3 -4
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient.js";
import SecurityClient from "~/utilities/SecurityClient.js";
import { PATH } from "../../../const.js";
/**
@@ -14,14 +14,13 @@ const checkAuth = async (req, res) => {
headers: {
"Content-Type": "application/json",
},
})
.then(res => {
}).then((res) => {
if (res.status == 200) {
return res;
} else {
console.log("Not authorized");
}
})
});
};
export default checkAuth;
@@ -1,32 +1,41 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
* This is the route that issues a backup private key that will afterwards be added into a pdf
*/
const issueBackupPrivateKey = ({encryptedPrivateKey, iv, tag, salt, verifier, clientProof}) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/backup-private-key", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"clientProof": clientProof,
"encryptedPrivateKey": encryptedPrivateKey,
"iv": iv,
"tag": tag,
"salt": salt,
"verifier": verifier
}),
})
.then(res => {
const issueBackupPrivateKey = ({
encryptedPrivateKey,
iv,
tag,
salt,
verifier,
clientProof,
}) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/password/backup-private-key",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
clientProof: clientProof,
encryptedPrivateKey: encryptedPrivateKey,
iv: iv,
tag: tag,
salt: salt,
verifier: verifier,
}),
}
).then((res) => {
if (res.status == 200) {
return res;
} else {
return res;
console.log("Failed to issue the backup key");
}
})
});
};
export default issueBackupPrivateKey;
+4 -5
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -14,9 +14,8 @@ const logout = async (req, res) => {
headers: {
"Content-Type": "application/json",
},
credentials: "include"
})
.then(res => {
credentials: "include",
}).then((res) => {
if (res.status == 200) {
SecurityClient.setToken("");
// Delete the cookie by not setting a value; Alternatively clear the local storage
@@ -30,7 +29,7 @@ const logout = async (req, res) => {
} else {
console.log("Failed to log out");
}
})
});
};
export default logout;
+6 -7
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -6,7 +6,7 @@ import { PATH } from "../../../const";
* @param {*} clientPublicKey
* @returns
*/
const SRP1 = ({clientPublicKey}) => {
const SRP1 = ({ clientPublicKey }) => {
return SecurityClient.fetchCall(PATH + "/api/v1/password/srp1", {
method: "POST",
headers: {
@@ -15,14 +15,13 @@ const SRP1 = ({clientPublicKey}) => {
body: JSON.stringify({
clientPublicKey,
}),
})
.then(async res => {
}).then(async (res) => {
if (res.status == 200) {
return (await res.json());
return await res.json();
} else {
console.log('Failed to do the first step of SRP');
console.log("Failed to do the first step of SRP");
}
})
});
};
export default SRP1;