CLASSROOMIO-T-140: Complete Cleanup CLASSROOMIO-T-140: Remove teacher & student input Co-authored-by: Tunji Adeyemi <tunji@digdippa.com> Merge-request: CLASSROOMIO-MR-72 Merged-by: Best Admin <best@digdippa.com>
26 lines
478 B
JavaScript
26 lines
478 B
JavaScript
import { validateEmail } from '$lib/utils/functions/validateEmail';
|
|
|
|
export function validateForm(fields) {
|
|
let hasError = false;
|
|
const { title, description } = fields;
|
|
const fieldErrors = {
|
|
title: '',
|
|
description: ''
|
|
};
|
|
|
|
if (!title) {
|
|
fieldErrors.title = 'Title is required';
|
|
hasError = true;
|
|
}
|
|
|
|
if (!description) {
|
|
fieldErrors.description = 'Description is required';
|
|
hasError = true;
|
|
}
|
|
|
|
return {
|
|
hasError,
|
|
fieldErrors
|
|
};
|
|
}
|