-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#31): added multi env support in integration
- Loading branch information
Showing
4 changed files
with
139 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters