mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2025-12-24 02:39:18 -05:00
fix: correct typing issue (#1715)
* fix(ntfy): display the current value of auth and fix types When using the username/password as auth method, the saved value was not displayed properly because of a wrong property name introduced by a missing type. * fix: correct typing issue --------- Co-authored-by: gauthier-th <mail@gauthierth.fr>
This commit is contained in:
@@ -6,6 +6,7 @@ import globalMessages from '@app/i18n/globalMessages';
|
||||
import defineMessages from '@app/utils/defineMessages';
|
||||
import { isValidURL } from '@app/utils/urlValidationHelper';
|
||||
import { ArrowDownOnSquareIcon, BeakerIcon } from '@heroicons/react/24/outline';
|
||||
import type { NotificationAgentNtfy } from '@server/lib/settings';
|
||||
import axios from 'axios';
|
||||
import { Field, Form, Formik } from 'formik';
|
||||
import { useState } from 'react';
|
||||
@@ -44,7 +45,7 @@ const NotificationsNtfy = () => {
|
||||
data,
|
||||
error,
|
||||
mutate: revalidate,
|
||||
} = useSWR('/api/v1/settings/notifications/ntfy');
|
||||
} = useSWR<NotificationAgentNtfy>('/api/v1/settings/notifications/ntfy');
|
||||
|
||||
const NotificationsNtfySchema = Yup.object().shape({
|
||||
url: Yup.string()
|
||||
@@ -78,15 +79,15 @@ const NotificationsNtfy = () => {
|
||||
return (
|
||||
<Formik
|
||||
initialValues={{
|
||||
enabled: data.enabled,
|
||||
types: data.types,
|
||||
url: data.options.url,
|
||||
topic: data.options.topic,
|
||||
authMethodUsernamePassword: data.options.authMethod,
|
||||
username: data.options.username,
|
||||
password: data.options.password,
|
||||
authMethodToken: data.options.authMethodToken,
|
||||
token: data.options.token,
|
||||
enabled: data?.enabled,
|
||||
types: data?.types,
|
||||
url: data?.options.url,
|
||||
topic: data?.options.topic,
|
||||
authMethodUsernamePassword: data?.options.authMethodUsernamePassword,
|
||||
username: data?.options.username,
|
||||
password: data?.options.password,
|
||||
authMethodToken: data?.options.authMethodToken,
|
||||
token: data?.options.token,
|
||||
}}
|
||||
validationSchema={NotificationsNtfySchema}
|
||||
onSubmit={async (values) => {
|
||||
@@ -302,7 +303,7 @@ const NotificationsNtfy = () => {
|
||||
</div>
|
||||
)}
|
||||
<NotificationTypeSelector
|
||||
currentTypes={values.enabled ? values.types : 0}
|
||||
currentTypes={values.enabled ? values.types || 0 : 0}
|
||||
onUpdate={(newTypes) => {
|
||||
setFieldValue('types', newTypes);
|
||||
setFieldTouched('types');
|
||||
|
||||
Reference in New Issue
Block a user