mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
29 lines
715 B
JavaScript
29 lines
715 B
JavaScript
import { PATH } from "~/const";
|
|
import SecurityClient from "~/utilities/SecurityClient";
|
|
|
|
/**
|
|
* This route creates a new workspace for a user.
|
|
* @param {*} workspaceName
|
|
* @returns
|
|
*/
|
|
const createWorkspace = (workspaceName, organizationId) => {
|
|
return SecurityClient.fetchCall(PATH + "/api/v1/workspace", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
workspaceName: workspaceName,
|
|
organizationId: organizationId,
|
|
}),
|
|
}).then(async (res) => {
|
|
if (res.status == 200) {
|
|
return (await res.json()).workspace;
|
|
} else {
|
|
console.log("Failed to create a project");
|
|
}
|
|
});
|
|
};
|
|
|
|
export default createWorkspace;
|