Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@ public MailJetNotificationController(CurrentUserServices currentUserServices,
}

@Post()
public Mono<? extends HttpResponse<?>> sendEmailReceivesStatus(String subject, String content, String... recipients) {
public Mono<HttpResponse<?>> sendEmailReceivesStatus(String subject, String content, String... recipients) {
return Mono.fromCallable(currentUserServices::getCurrentUser)
.map(currentUser -> {
String fromName = currentUser.getFirstName() + " " + currentUser.getLastName();
return emailSender.sendEmailReceivesStatus(fromName, currentUser.getWorkEmail(), subject, content, recipients);
})
.map(success -> (HttpResponse<?>) HttpResponse.ok());
.map(success -> {
if(success){
return HttpResponse.ok();
} else {
return HttpResponse.serverError();
}
});
}
}
2 changes: 1 addition & 1 deletion server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ micronaut:
executors:
io:
type: fixed
n-threads: 80 # todo set value based on some multiple of available processors for better scalability. Micronaut's default is cores * 2, but that seems low.
n-threads: 40 # Keep in sync with max pool size on datasource

security:
enabled: true
Expand Down
14 changes: 10 additions & 4 deletions web-ui/src/api/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UPDATE_TOAST } from '../context/actions';
import {UPDATE_TOAST} from '../context/actions';
import qs from 'qs';

export const BASE_API_URL = import.meta.env.VITE_APP_API_URL
Expand Down Expand Up @@ -76,15 +76,21 @@ export const resolve = async payload => {
};

resolved.payload = await promise;

if (!resolved.payload.ok) {
const statusText = resolved.payload.statusText;
resolved.error = await resolved.payload.json();
try {
resolved.error = await resolved.payload.json();
} catch (error) {
resolved.error = resolved.payload.statusText;
console.log(error);
}

if (window.snackDispatch) {
window.snackDispatch({
type: UPDATE_TOAST,
payload: {
severity: 'error',
toast: resolved?.error?.message || statusText
toast: resolved?.error
}
});
}
Expand Down