Push
This commit is contained in:
@@ -7,8 +7,8 @@ const axiosInstance = axios.create({
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
const axiosInstance = axios.create({
|
const axiosInstance = axios.create({
|
||||||
//baseURL: 'https://api.testsite.deinedorfapp.de/api',
|
baseURL: 'https://api.testsite.deinedorfapp.de/api',
|
||||||
baseURL: 'http://localhost:5173/api',
|
//baseURL: 'http://localhost:5173/api',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import axiosInstance from '../../api/axiosInstance.js';
|
|||||||
export default function PushPage() {
|
export default function PushPage() {
|
||||||
const [title, setTitle] = useState('');
|
const [title, setTitle] = useState('');
|
||||||
const [body, setBody] = useState('');
|
const [body, setBody] = useState('');
|
||||||
const [target, setTarget] = useState('all');
|
const [target, setTarget] = useState('NOTIFICATION_ALL');
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [result, setResult] = useState(null); // { type: 'success'|'error', msg }
|
const [result, setResult] = useState(null); // { type: 'success'|'error', msg }
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@ export default function PushPage() {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
setResult(null);
|
setResult(null);
|
||||||
try {
|
try {
|
||||||
await axiosInstance.post('/push', { title, body, target });
|
await axiosInstance.post('/notification/manual', { title, body, targetPlatform: target, });
|
||||||
setResult({ type: 'success', msg: 'Notification erfolgreich gesendet!' });
|
setResult({ type: 'success', msg: 'Notification erfolgreich zur Queue hinzugefügt!' });
|
||||||
setTitle('');
|
setTitle('');
|
||||||
setBody('');
|
setBody('');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -38,9 +38,9 @@ export default function PushPage() {
|
|||||||
<FormControl fullWidth>
|
<FormControl fullWidth>
|
||||||
<InputLabel>Empfänger</InputLabel>
|
<InputLabel>Empfänger</InputLabel>
|
||||||
<Select value={target} label="Empfänger" onChange={(e) => setTarget(e.target.value)}>
|
<Select value={target} label="Empfänger" onChange={(e) => setTarget(e.target.value)}>
|
||||||
<MenuItem value="all">Alle Nutzer</MenuItem>
|
<MenuItem value="NOTIFICATION_ALL">Alle Nutzer</MenuItem>
|
||||||
<MenuItem value="ios">Nur iOS</MenuItem>
|
<MenuItem value="NOTIFICATION_IOS">Nur iOS</MenuItem>
|
||||||
<MenuItem value="android">Nur Android</MenuItem>
|
<MenuItem value="NOTIFICATION_ANDROID">Nur Android</MenuItem>
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user