Skip to content

Commit

Permalink
Merge pull request #4 from vercel-labs/teams
Browse files Browse the repository at this point in the history
fix: get team slug
  • Loading branch information
Kikobeats authored Dec 11, 2024
2 parents 4a3bfe4 + 791f84f commit d2d2b80
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ const vercelApi = (pathname: string) =>
}
})

async function getProjectName (projectId: string) {
return vercelApi(`v9/projects/${projectId}`)
async function getProjectName (projectId: string, teamId: string) {
return vercelApi(`v9/projects/${projectId}?teamId=${teamId}`)
.then(res => res.json())
.then((payload: any) => payload.name)
}

const getOrganizationName = async (teamId: string) =>
vercelApi(`v2/teams/${teamId}`)
.then(res => res.json())
.then((payload: any) => payload.name)
.then((payload: any) => payload.slug)

export const getLatestDeployment = async () => {
const { projectId } = await readProjectFile()
Expand Down Expand Up @@ -54,7 +54,7 @@ async function readProjectFile (): Promise<{
async function fromPath (): Promise<{ org: string; project: string }> {
const { projectId, teamId } = await readProjectFile()
const org = await getOrganizationName(teamId)
const project = await getProjectName(projectId)
const project = await getProjectName(projectId, teamId)
return { org, project }
}

Expand Down

0 comments on commit d2d2b80

Please sign in to comment.