Skip to content

Commit

Permalink
fix(ui): restore saved states of quota override checkboxes (#1282)
Browse files Browse the repository at this point in the history
* fix(ui): restore saved states of quota override checkboxes

* fix: check if value is undefined or null, not just truthy

Co-authored-by: sct <ryan@sct.dev>
  • Loading branch information
TheCatLady and sct committed Mar 25, 2021
1 parent 7230915 commit 2059fc1
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import { Field, Form, Formik } from 'formik';
import { useRouter } from 'next/router';
import React, { useMemo, useState } from 'react';
import React, { useEffect, useMemo, useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useToasts } from 'react-toast-notifications';
import useSWR from 'swr';
Expand Down Expand Up @@ -57,6 +57,15 @@ const UserGeneralSettings: React.FC = () => {
user ? `/api/v1/user/${user?.id}/settings/main` : null
);

useEffect(() => {
setMovieQuotaEnabled(
data?.movieQuotaLimit != undefined && data?.movieQuotaDays != undefined
);
setTvQuotaEnabled(
data?.tvQuotaLimit != undefined && data?.tvQuotaDays != undefined
);
}, [data]);

const { data: languages, error: languagesError } = useSWR<Language[]>(
'/api/v1/languages'
);
Expand Down

0 comments on commit 2059fc1

Please sign in to comment.