mirror of
https://github.com/logos-messaging/OpChan.git
synced 2026-01-02 12:53:10 +00:00
fix: url loading for cell creation
This commit is contained in:
parent
4c2f7ab341
commit
6ddc2a47ad
@ -23,7 +23,6 @@ import {
|
||||
DialogTrigger,
|
||||
} from '@/components/ui/dialog';
|
||||
import { useToast } from '@/hooks/use-toast';
|
||||
import { urlLoads } from '@/utils';
|
||||
|
||||
const formSchema = z.object({
|
||||
title: z
|
||||
@ -39,8 +38,13 @@ const formSchema = z.object({
|
||||
.optional()
|
||||
.refine(
|
||||
val => {
|
||||
if (!val) return true;
|
||||
return urlLoads(val);
|
||||
if (!val || val.trim() === '') return true;
|
||||
try {
|
||||
const urlObj = new URL(val);
|
||||
return urlObj.protocol === 'http:' || urlObj.protocol === 'https:';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{
|
||||
message: 'Icon must be a valid URL',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user