加载过程优化

This commit is contained in:
undefined committed 2020-06-17 13:15:12 +08:00
1 parent bc6426927f
commit 5db23edebb
8 files changed
+74 -58

No files matched your search

+4 -8
View File
@@ -149,10 +149,8 @@ class ContestEditHandler extends ContestDetailHandler {
async post({
domainId, beginAtDate, beginAtTime, duration, title, content, rule, pids, rated = false,
}) {
let beginAt;
try {
beginAt = moment.tz(`${beginAtDate} ${beginAtTime}`, this.user.timeZone);
} catch (e) {
let beginAt = moment.tz(`${beginAtDate} ${beginAtTime}`, this.user.timeZone);
if (!beginAt.isValid()) {
throw new ValidationError('beginAtDate', 'beginAtTime');
}
const endAt = beginAt.clone().add(duration, 'hours').toDate();
@@ -288,10 +286,8 @@ class ContestCreateHandler extends ContestHandler {
async post({
domainId, title, content, rule, beginAtDate, beginAtTime, duration, pids, rated = false,
}) {
let beginAt;
try {
beginAt = moment.tz(`${beginAtDate} ${beginAtTime}`, this.user.timeZone);
} catch (e) {
const beginAt = moment.tz(`${beginAtDate} ${beginAtTime}`, this.user.timeZone);
if (!beginAt.isValid()) {
throw new ValidationError('beginAtDate', 'beginAtTime');
}
const endAt = beginAt.clone().add(duration, 'hours');