stripping - from additional app name number

This commit is contained in:
Martin McKeaveney 2022-11-05 14:43:07 +00:00
parent a4c04fd329
commit 67bfa63861
1 changed files with 4 additions and 2 deletions

View File

@ -167,11 +167,13 @@
const autoCreateApp = async () => {
try {
// Auto name app if has same name
let appName = template.key.replace("app/", "")
const templateKey = template.key.split("/")[1]
let appName = templateKey.replace(/-/g, " ")
const appsWithSameName = $apps.filter(app =>
app.name?.startsWith(appName)
)
appName = `${appName}-${appsWithSameName.length + 1}`
appName = `${appName} ${appsWithSameName.length + 1}`
// Create form data to create app
let data = new FormData()