mirror of
https://github.com/diced/zipline.git
synced 2026-06-12 19:01:18 -07:00
feat: mimetype overhauls
This commit is contained in:
@@ -6,6 +6,22 @@ import { IconDeviceFloppy } from '@tabler/icons-react';
|
||||
import { useForm } from '@mantine/form';
|
||||
import { NavigateFunction } from 'react-router-dom';
|
||||
|
||||
export function checkCommaArray(value: unknown): string[] {
|
||||
if (!value) return [];
|
||||
|
||||
if (value && typeof value === 'string' && value.trim() === '') return [];
|
||||
|
||||
if (!Array.isArray(value) && typeof value === 'string')
|
||||
return value
|
||||
.split(',')
|
||||
.map((x) => x.trim())
|
||||
.filter((x) => x !== '');
|
||||
|
||||
if (Array.isArray(value)) return value.map((x) => String(x).trim()).filter((x) => x !== '');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
export function settingsOnSubmit(navigate: NavigateFunction, form: ReturnType<typeof useForm<any>>) {
|
||||
return async (values: unknown) => {
|
||||
const { data, error } = await fetchApi<Response['/api/server/settings']>(
|
||||
|
||||
Reference in New Issue
Block a user