Skip to content

Commit

Permalink
fix: display success or error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopico-dev committed Apr 7, 2024
1 parent 3694bfd commit 2d314da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
12 changes: 12 additions & 0 deletions src/main/resources/static/css/n2rss.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,15 @@ div.g-recaptcha {
display: flex;
justify-content: center;
}

.message {
margin: 8px auto;
}

.message.message-success {
color: #017701;
}

.message.message-error {
color: #c60101;
}
6 changes: 3 additions & 3 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ <h1>Newsletters to RSS</h1>

<input type="submit" id="sendRequest" value="Send request"
th:disabled="${reCaptchaEnabled} ? 'disabled' : null">
<div id="message" class="message" style="display: none"></div>
</form>
<div id="message" class="alert" style="display: none"></div>

<a href="https://github.com/nicopico-dev/n2rss" target="_blank">
<img
Expand Down Expand Up @@ -127,11 +127,11 @@ <h1>Newsletters to RSS</h1>
throw new Error("HTTP error " + response.status);
}
message.textContent = "Successfully subscribed!";
message.classList.add('alert-success');
message.classList.value = "message message-success"
})
.catch(() => {
message.textContent = "There was an error subscribing.";
message.classList.add('alert-danger');
message.classList.value = "message message-error";
})
.finally(() => {
message.style.display = "block";
Expand Down

0 comments on commit 2d314da

Please sign in to comment.