This commit is contained in:
2026-04-15 11:38:42 +02:00
parent ccb1e912df
commit bd10bdc3ed
2 changed files with 8 additions and 8 deletions

View File

@@ -7,8 +7,8 @@ const axiosInstance = axios.create({
*/
const axiosInstance = axios.create({
//baseURL: 'https://api.testsite.deinedorfapp.de/api',
baseURL: 'http://localhost:5173/api',
baseURL: 'https://api.testsite.deinedorfapp.de/api',
//baseURL: 'http://localhost:5173/api',
headers: { 'Content-Type': 'application/json' },
});

View File

@@ -9,7 +9,7 @@ import axiosInstance from '../../api/axiosInstance.js';
export default function PushPage() {
const [title, setTitle] = useState('');
const [body, setBody] = useState('');
const [target, setTarget] = useState('all');
const [target, setTarget] = useState('NOTIFICATION_ALL');
const [loading, setLoading] = useState(false);
const [result, setResult] = useState(null); // { type: 'success'|'error', msg }
@@ -18,8 +18,8 @@ export default function PushPage() {
setLoading(true);
setResult(null);
try {
await axiosInstance.post('/push', { title, body, target });
setResult({ type: 'success', msg: 'Notification erfolgreich gesendet!' });
await axiosInstance.post('/notification/manual', { title, body, targetPlatform: target, });
setResult({ type: 'success', msg: 'Notification erfolgreich zur Queue hinzugefügt!' });
setTitle('');
setBody('');
} catch (err) {
@@ -38,9 +38,9 @@ export default function PushPage() {
<FormControl fullWidth>
<InputLabel>Empfänger</InputLabel>
<Select value={target} label="Empfänger" onChange={(e) => setTarget(e.target.value)}>
<MenuItem value="all">Alle Nutzer</MenuItem>
<MenuItem value="ios">Nur iOS</MenuItem>
<MenuItem value="android">Nur Android</MenuItem>
<MenuItem value="NOTIFICATION_ALL">Alle Nutzer</MenuItem>
<MenuItem value="NOTIFICATION_IOS">Nur iOS</MenuItem>
<MenuItem value="NOTIFICATION_ANDROID">Nur Android</MenuItem>
</Select>
</FormControl>