mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 23:15:36 +00:00
feat: add create link form
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import Collection from '#models/collection';
|
||||
import type Collection from '#models/collection';
|
||||
|
||||
export const appendCollectionId = (
|
||||
url: string,
|
||||
@@ -7,3 +7,15 @@ export const appendCollectionId = (
|
||||
|
||||
export const appendResourceId = (url: string, resourceId?: string) =>
|
||||
`${url}${resourceId && `/${resourceId}`}}`;
|
||||
|
||||
export function isValidHttpUrl(urlParam: string) {
|
||||
let url;
|
||||
|
||||
try {
|
||||
url = new URL(urlParam);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||
}
|
||||
Reference in New Issue
Block a user