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
2 changes: 0 additions & 2 deletions apps/backend/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DynamoDbService } from '../dynamodb';
import { UserInputModel, UserStatus, Role } from './user.model';
import { NewUserInput } from '../dtos/newUserDTO';


@Injectable()
export class UserService {
private readonly tableName = 'gibostonUsers';
Expand Down Expand Up @@ -53,7 +52,6 @@ export class UserService {
}
}


public async getUserTables(userId: number): Promise<Array<number>> {
try {
const key = { userId: { N: userId.toString() } };
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
VITE_GOOGLE_MAPS_API_KEY=INSERT_API_KEY_HERE

33 changes: 32 additions & 1 deletion apps/frontend/src/pages/registerPage/formPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ const FormPage: React.FC<FormPageProps> = ({ setIsSubmitted }) => {
});
const [showPassword, setShowPassword] = useState(false);
const [showRePassword, setShowRePassword] = useState(false);
const [userId, setUserId] = useState('');
const [error, setError] = useState('');

const UserStatus = {
APPROVED: 'Approved',
PENDING: 'Pending',
DENIED: 'Denied',
};

const handleTogglePassword = () => {
setShowPassword((prev) => !prev);
Expand All @@ -47,7 +55,29 @@ const FormPage: React.FC<FormPageProps> = ({ setIsSubmitted }) => {
setShowRePassword((prev) => !prev);
};

// Define the validation schema using Yup
const handleSubmit = async () => {
if (!userId.trim()) {
setError('User ID required');
return;
}
//console.log('UserID: ', userId);

try {
const response = await axios.put(
`${import.meta.env.VITE_API_BASE_URL}/users/editUser/${userId}`,
{ status: UserStatus.APPROVED },
);

setIsSubmitted(true);

//console.log('Response:', response.data);
} catch (e) {
setError('Failed to approve user. Please try again.');
console.error('Error: ', e);
}
};

// Validation schema using Yup
const validationSchema = Yup.object({
userId: Yup.string().required('User ID is required'),
email: Yup.string()
Expand Down Expand Up @@ -313,6 +343,7 @@ const FormPage: React.FC<FormPageProps> = ({ setIsSubmitted }) => {
}}
sx={{ '& .MuiFilledInput-root': { fontFamily: 'Montserrat' } }}
/>

{formik.touched.rePassword && formik.errors.rePassword && (
<FormHelperText
error
Expand Down
Loading