Skip to content

Commit

Permalink
feat: missing env vars
Browse files Browse the repository at this point in the history
Signed-off-by: Azanul <azanulhaque@gmail.com>
  • Loading branch information
Azanul committed Jun 3, 2024
1 parent 1eeb672 commit 13f72be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
6 changes: 6 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ services:
condition: service_healthy
user-service:
condition: service_started
environment:
USER_SERVICE_URL: user-service
NOTIFICATION_SERVICE_URL: notification-service
AUTH_SERVICE_ADDR: user-service
KAFKA_BROKERS: kafka:9092

user-service:
build: ./user
Expand All @@ -28,6 +33,7 @@ services:
environment:
TWILIO_ACCOUNT_SID: ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_AUTH_TOKEN: your_auth_token
KAFKA_BROKERS: kafka:9092

zookeeper:
image: confluentinc/cp-zookeeper:latest
Expand Down
26 changes: 20 additions & 6 deletions frontend/src/components/WuphfForm.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
import { sendWuphf } from '../features/wuphf/wuphfSlice';

const WuphfForm: React.FC = () => {
const [message, setMessage] = useState('');
const dispatch = useDispatch();
const [status, setStatus] = useState('');

const handleSubmit = (e: React.FormEvent) => {
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
dispatch(sendWuphf(message));
setMessage('');
try {
const response = await fetch(`http://${process.env.REACT_APP_BASE_URL}/notification`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ message }),
});
if (response.ok) {
setStatus('Message sent successfully');
setMessage('');
} else {
setStatus('Failed to send message');
}
} catch (error) {
setStatus('Error sending message');
}
};

return (
Expand All @@ -24,6 +37,7 @@ const WuphfForm: React.FC = () => {
<button type="submit" className="px-4 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600">
Send
</button>
{status && <p>{status}</p>}
</form>
);
};
Expand Down

0 comments on commit 13f72be

Please sign in to comment.