Skip to content

Commit

Permalink
change settings for submit
Browse files Browse the repository at this point in the history
  • Loading branch information
bobrov-site committed Jun 10, 2024
1 parent bfb32d0 commit b1bf035
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions frontend/src/components/Forms/AppearanceForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ function ApperearanceForm() {
const initialFormState = { state: 'initial', message: '' };
const [formState, setFormState] = useState(initialFormState);
const initialValues = {
selectedLanguage: language,
selectedTheme: ternaryDarkMode,
selectedLanguage: '',
selectedTheme: '',
};
const formik = useFormik({
initialValues,
onSubmit: (values) => {
const { selectedLanguage, selectedTheme } = values;
setFormState(initialFormState);
setLanguage(selectedLanguage);
setTernaryDarkMode(selectedTheme);
setLanguage(selectedLanguage !== '' ? selectedLanguage : language);
setTernaryDarkMode(
selectedTheme !== '' ? selectedTheme : ternaryDarkMode,
);
setFormState({
state: 'success',
message: 'profileSettings.updateSuccessful',
Expand Down

0 comments on commit b1bf035

Please sign in to comment.