Skip to content

Commit

Permalink
FE: small refactoring of watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
andreipradan committed Feb 20, 2025
1 parent 6430369 commit d67acff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion frontend/src/api/watchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ class WatchersApi extends mix(CreateApi, DeleteApi, DetailApi, ListApi, TokenMix
.put(`${base}test/`, data, { headers: { Authorization: token } })
.then(response => {
toast[response.data.is_new ? 'success' : 'info'](
<span>{response.data.is_new ? 'New item found!' : 'Existing item'}<br/>{response.data.result}</span>,
<span>
{
response.data.is_new === undefined
? 'New watcher - test'
: response.data.is_new
? 'New item found!' : 'Existing item'
}<br/>
{response.data.result}
</span>,
toastParams
);
dispatch(setLoading(false))
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/commands/Watchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ const Watchers = () => {
onClick={() => dispatch(WatchersApi.test(
token,
{
name,
url,
latest: JSON.parse(latest.replace(/[\r\n\t]/g, "")),
request: JSON.parse(request.replace(/[\r\n\t]/g, "")),
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/app/user-pages/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const Register = () => {
{
errors?.non_field_errors
? <Errors errors={errors.non_field_errors}/>
: null
: !errors?.email && !errors?.password
? <Errors errors={errors}/>
: null
}

<Form className="pt-3" onSubmit={register}>
Expand Down

0 comments on commit d67acff

Please sign in to comment.