mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 09:55:06 +03:00
fix: trim whitespace from the front and back of project name
This commit is contained in:
1 parent
ee871a0e2a
commit
8499bc8668
3 files changed
+8
-6
No files matched your search
@@ -25,7 +25,9 @@ const General: FC<Props> = ({}) => {
|
||||
const canUpdateProject = checkPermissions(PermissionAction.UPDATE, 'projects')
|
||||
|
||||
const onSubmit = async (values: any, { resetForm }: any) => {
|
||||
const response = await post(`${API_URL}/projects/${project?.ref}/update`, { name: values.name })
|
||||
const response = await post(`${API_URL}/projects/${project?.ref}/update`, {
|
||||
name: values.name.trim(),
|
||||
})
|
||||
if (response.error) {
|
||||
ui.setNotification({
|
||||
category: 'error',
|
||||
|
||||
@@ -162,7 +162,7 @@ const Wizard: NextPageWithLayout = () => {
|
||||
const data: Record<string, any> = {
|
||||
cloud_provider: PROVIDERS.AWS.id, // hardcoded for DB instances to be under AWS
|
||||
org_id: currentOrg?.id,
|
||||
name: projectName,
|
||||
name: projectName.trim(),
|
||||
db_pass: dbPass,
|
||||
db_region: dbRegion,
|
||||
db_pricing_tier_id: (PRICING_TIER_PRODUCT_IDS as any)[dbTier],
|
||||
|
||||
@@ -42,8 +42,7 @@ const Wizard: NextPageWithLayout = () => {
|
||||
const [newOrgLoading, setNewOrgLoading] = useState(false)
|
||||
|
||||
function validateOrgName(name: any) {
|
||||
const value = name ? name.trim() : ''
|
||||
return value.length >= 1
|
||||
return name.length >= 1
|
||||
}
|
||||
|
||||
function onOrgNameChange(e: any) {
|
||||
@@ -60,7 +59,8 @@ const Wizard: NextPageWithLayout = () => {
|
||||
|
||||
async function onClickSubmit(e: any) {
|
||||
e.preventDefault()
|
||||
const isOrgNameValid = validateOrgName(orgName)
|
||||
const trimmedOrgName = orgName ? orgName.trim() : ''
|
||||
const isOrgNameValid = validateOrgName(trimmedOrgName)
|
||||
if (!isOrgNameValid) {
|
||||
ui.setNotification({ category: 'error', message: 'Organization name is empty' })
|
||||
return
|
||||
@@ -68,7 +68,7 @@ const Wizard: NextPageWithLayout = () => {
|
||||
|
||||
setNewOrgLoading(true)
|
||||
const response = await post(`${API_URL}/organizations`, {
|
||||
name: orgName,
|
||||
name: trimmedOrgName,
|
||||
kind: orgKind,
|
||||
...(orgKind == 'COMPANY' ? { size: orgSize } : {}),
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user