fix(frontend): call mutate after changing public settings (#1302)

pull/1307/head
TheCatLady 4 years ago committed by GitHub
parent bec1d3dde8
commit c8f67cf866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@ import { Field, Form, Formik } from 'formik';
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import { useToasts } from 'react-toast-notifications'; import { useToasts } from 'react-toast-notifications';
import useSWR from 'swr'; import useSWR, { mutate } from 'swr';
import * as Yup from 'yup'; import * as Yup from 'yup';
import type { Language, MainSettings } from '../../../server/lib/settings'; import type { Language, MainSettings } from '../../../server/lib/settings';
import { Permission, useUser } from '../../hooks/useUser'; import { Permission, useUser } from '../../hooks/useUser';
@ -162,6 +162,7 @@ const SettingsMain: React.FC = () => {
trustProxy: values.trustProxy, trustProxy: values.trustProxy,
cacheImages: values.cacheImages, cacheImages: values.cacheImages,
}); });
mutate('/api/v1/settings/public');
addToast(intl.formatMessage(messages.toastSettingsSuccess), { addToast(intl.formatMessage(messages.toastSettingsSuccess), {
autoDismiss: true, autoDismiss: true,

@ -1,7 +1,7 @@
import axios from 'axios'; import axios from 'axios';
import React, { useState } from 'react'; import React, { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import useSWR from 'swr'; import useSWR, { mutate } from 'swr';
import type { import type {
RadarrSettings, RadarrSettings,
SonarrSettings, SonarrSettings,
@ -213,6 +213,7 @@ const SettingsServices: React.FC = () => {
setDeleteServerModal({ open: false, serverId: null, type: 'radarr' }); setDeleteServerModal({ open: false, serverId: null, type: 'radarr' });
revalidateRadarr(); revalidateRadarr();
revalidateSonarr(); revalidateSonarr();
mutate('/api/v1/settings/public');
}; };
return ( return (
@ -237,6 +238,7 @@ const SettingsServices: React.FC = () => {
onClose={() => setEditRadarrModal({ open: false, radarr: null })} onClose={() => setEditRadarrModal({ open: false, radarr: null })}
onSave={() => { onSave={() => {
revalidateRadarr(); revalidateRadarr();
mutate('/api/v1/settings/public');
setEditRadarrModal({ open: false, radarr: null }); setEditRadarrModal({ open: false, radarr: null });
}} }}
/> />
@ -247,6 +249,7 @@ const SettingsServices: React.FC = () => {
onClose={() => setEditSonarrModal({ open: false, sonarr: null })} onClose={() => setEditSonarrModal({ open: false, sonarr: null })}
onSave={() => { onSave={() => {
revalidateSonarr(); revalidateSonarr();
mutate('/api/v1/settings/public');
setEditSonarrModal({ open: false, sonarr: null }); setEditSonarrModal({ open: false, sonarr: null });
}} }}
/> />

Loading…
Cancel
Save