mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 16:28:40 +00:00
feat(#31): added multi env support in integration
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import SecurityClient from '~/utilities/SecurityClient';
|
||||
|
||||
interface Workspace {
|
||||
__v: number;
|
||||
_id: string;
|
||||
name: string;
|
||||
organization: string;
|
||||
environments: Array<{ name: string; slug: string }>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This route lets us get the workspaces of a certain user
|
||||
* @returns
|
||||
*/
|
||||
const getAWorkspace = (workspaceID:string) => {
|
||||
return SecurityClient.fetchCall(`/api/v1/workspace/${workspaceID}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
}).then(async (res) => {
|
||||
if (res?.status == 200) {
|
||||
const data = (await res.json()) as unknown as { workspace: Workspace };
|
||||
return data.workspace;
|
||||
}
|
||||
|
||||
throw new Error('Failed to get workspace');
|
||||
});
|
||||
};
|
||||
|
||||
export default getAWorkspace;
|
||||
Reference in New Issue
Block a user