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
+12 -10
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -8,19 +8,21 @@ import { PATH } from "../../../const";
* @returns
*/
const getOrganization = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return (await res.json()).organization;
} else {
console.log('Failed to get org info');
console.log("Failed to get org info");
}
})
});
};
export default getOrganization;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -8,19 +8,21 @@ import { PATH } from "../../../const";
* @returns
*/
const getOrganizationProjects = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/organization/" + req.orgId + "/workspaces", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/organization/" + req.orgId + "/workspaces",
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return (await res.json()).workspaces;
} else {
console.log('Failed to get projects for an org');
console.log("Failed to get projects for an org");
}
})
});
};
export default getOrganizationProjects;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -8,19 +8,21 @@ import { PATH } from "../../../const";
* @returns
*/
const getOrganizationSubscriptions = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId + "/subscriptions", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId + "/subscriptions",
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return (await res.json()).subscriptions;
} else {
console.log('Failed to get org subscriptions');
console.log("Failed to get org subscriptions");
}
})
});
};
export default getOrganizationSubscriptions;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -8,19 +8,21 @@ import { PATH } from "../../../const";
* @returns
*/
const getOrganizationUserProjects = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId + "/my-workspaces", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId + "/my-workspaces",
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return (await res.json()).workspaces;
} else {
console.log('Failed to get projects of a user in an org');
console.log("Failed to get projects of a user in an org");
}
})
});
};
export default getOrganizationUserProjects;
+12 -10
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -8,19 +8,21 @@ import { PATH } from "../../../const";
* @returns
*/
const getOrganizationUsers = (req, res) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + req.orgId + "/users", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + req.orgId + "/users",
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return (await res.json()).users;
} else {
console.log('Failed to get org users');
console.log("Failed to get org users");
}
})
});
};
export default getOrganizationUsers;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -7,20 +7,22 @@ import { PATH } from "../../../const";
* @param {*} res
* @returns
*/
const StripeRedirect = ({orgId}) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + orgId + "/customer-portal-session", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
if (res.status == 200) {
return window.location.href = (await res.json()).url;
} else {
console.log('Failed to redirect to Stripe');
const StripeRedirect = ({ orgId }) => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + orgId + "/customer-portal-session",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
}
})
).then(async (res) => {
if (res.status == 200) {
return (window.location.href = (await res.json()).url);
} else {
console.log("Failed to redirect to Stripe");
}
});
};
export default StripeRedirect;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -7,22 +7,24 @@ import { PATH } from "../../../const";
* @returns
*/
const addIncidentContact = (organizationId, email) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: email,
}),
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: email,
}),
}
).then(async (res) => {
if (res.status == 200) {
return res;
} else {
console.log('Failed to add an incident contact');
console.log("Failed to add an incident contact");
}
})
});
};
export default addIncidentContact;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -17,14 +17,13 @@ const addUserToOrg = (email, orgId) => {
inviteeEmail: email,
organizationId: orgId,
}),
})
.then(async res => {
}).then(async (res) => {
if (res.status == 200) {
return res;
} else {
console.log('Failed to add a user to an org');
console.log("Failed to add a user to an org");
}
})
});
};
export default addUserToOrg;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -7,22 +7,24 @@ import { PATH } from "../../../const";
* @returns
*/
const deleteIncidentContact = (organizaionId, email) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + organizaionId + "/incidentContactOrg", {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: email,
}),
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + organizaionId + "/incidentContactOrg",
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
email: email,
}),
}
).then(async (res) => {
if (res.status == 200) {
return res;
} else {
console.log('Failed to delete an incident contact');
console.log("Failed to delete an incident contact");
}
})
});
};
export default deleteIncidentContact;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -7,19 +7,21 @@ import { PATH } from "../../../const";
* @returns
*/
const deleteUserFromOrganization = (membershipId) => {
return SecurityClient.fetchCall(PATH + "/api/v1/membership-org/" + membershipId, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/membership-org/" + membershipId,
{
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return res;
} else {
console.log('Failed to delete a user from an org');
console.log("Failed to delete a user from an org");
}
})
});
};
export default deleteUserFromOrganization;
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -7,19 +7,21 @@ import { PATH } from "../../../const";
* @returns
*/
const getIncidentContacts = (organizationId) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg", {
method: "GET",
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + organizationId + "/incidentContactOrg",
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
).then(async (res) => {
if (res.status == 200) {
return (await res.json()).incidentContactsOrg;
} else {
console.log('Failed to get incident contacts');
console.log("Failed to get incident contacts");
}
})
});
};
export default getIncidentContacts;
+4 -5
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -13,14 +13,13 @@ const getOrganizations = (req, res) => {
headers: {
"Content-Type": "application/json",
},
})
.then(async res => {
}).then(async (res) => {
if (res.status == 200) {
return (await res.json()).organizations;
} else {
console.log('Failed to get orgs of a user');
console.log("Failed to get orgs of a user");
}
})
});
};
export default getOrganizations;
+15 -13
View File
@@ -1,4 +1,4 @@
import SecurityClient from "../../../components/utilities/SecurityClient";
import SecurityClient from "~/utilities/SecurityClient";
import { PATH } from "../../../const";
/**
@@ -8,22 +8,24 @@ import { PATH } from "../../../const";
* @returns
*/
const renameOrg = (orgId, newOrgName) => {
return SecurityClient.fetchCall(PATH + "/api/v1/organization/" + orgId + "/name", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: newOrgName,
}),
})
.then(async res => {
return SecurityClient.fetchCall(
PATH + "/api/v1/organization/" + orgId + "/name",
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
name: newOrgName,
}),
}
).then(async (res) => {
if (res.status == 200) {
return res;
} else {
console.log('Failed to rename an organization');
console.log("Failed to rename an organization");
}
})
});
};
export default renameOrg;