This commit is contained in:
@@ -3,5 +3,5 @@
|
|||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"printWidth": 100,
|
"printWidth": 100,
|
||||||
"tabWidth": 2
|
"tabWidth": 4
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,11 @@ export function usePaginatedResource<TItem>({
|
|||||||
setPageSize(response.pageSize);
|
setPageSize(response.pageSize);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
setError(err instanceof Error ? err.message : 'Request failed. Please try again.');
|
setError(
|
||||||
|
err instanceof Error
|
||||||
|
? err.message
|
||||||
|
: 'Request failed. Please try again.',
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (!cancelled) {
|
if (!cancelled) {
|
||||||
|
|||||||
@@ -76,7 +76,11 @@ export function useValidatedFields<TValues extends Record<string, string>>({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const setFieldValue = useCallback(
|
const setFieldValue = useCallback(
|
||||||
<K extends keyof TValues>(key: K, value: TValues[K], options: SetFieldValueOptions = {}) => {
|
<K extends keyof TValues>(
|
||||||
|
key: K,
|
||||||
|
value: TValues[K],
|
||||||
|
options: SetFieldValueOptions = {},
|
||||||
|
) => {
|
||||||
const { validate: shouldValidate = true, touch = true } = options;
|
const { validate: shouldValidate = true, touch = true } = options;
|
||||||
|
|
||||||
if (touch) {
|
if (touch) {
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ const toTitleCase = (s: string) =>
|
|||||||
.trim()
|
.trim()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.split(/\s+/)
|
.split(/\s+/)
|
||||||
.map((w) => (/^[A-Z]{2,4}$/.test(w) ? w : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()))
|
.map((w) =>
|
||||||
|
/^[A-Z]{2,4}$/.test(w) ? w : w.charAt(0).toUpperCase() + w.slice(1).toLowerCase(),
|
||||||
|
)
|
||||||
.join(' ');
|
.join(' ');
|
||||||
|
|
||||||
const splitUnderscoreHyphen = (s: string) => s.replaceAll(/[_-]+/g, ' ');
|
const splitUnderscoreHyphen = (s: string) => s.replaceAll(/[_-]+/g, ' ');
|
||||||
|
|||||||
Reference in New Issue
Block a user