Add webhook blocks API public endpoints

This commit is contained in:
Baptiste Arnaud
2022-11-30 13:57:28 +01:00
parent f9ffdbc4c5
commit c799717905
67 changed files with 3030 additions and 429 deletions

View File

@@ -0,0 +1,2 @@
export * from './parseNewName'
export * from './setWorkspaceIdInLocalStorage'

View File

@@ -0,0 +1,17 @@
import { Workspace } from 'models'
export const parseNewName = (
userFullName: string | undefined,
existingWorkspaces: Pick<Workspace, 'name'>[]
) => {
const workspaceName = userFullName
? `${userFullName}'s workspace`
: 'My workspace'
let newName = workspaceName
let i = 1
while (existingWorkspaces.find((w) => w.name === newName)) {
newName = `${workspaceName} (${i})`
i++
}
return newName
}

View File

@@ -0,0 +1,3 @@
export const setWorkspaceIdInLocalStorage = (workspaceId: string) => {
localStorage.setItem('workspaceId', workspaceId)
}