mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-11 11:12:44 +00:00
add notif working
This commit is contained in:
@@ -13,13 +13,15 @@ const NotificationAdd = () => {
|
|||||||
const dismissKeyRef = useRef(null);
|
const dismissKeyRef = useRef(null);
|
||||||
const titleRef = useRef(null);
|
const titleRef = useRef(null);
|
||||||
const textRef = useRef(null);
|
const textRef = useRef(null);
|
||||||
const [startAt, setStartAt] = useState(null);
|
const startAtRef = useRef(null);
|
||||||
const [stopAt, setStopAt] = useState(null);
|
const stopAtRef = useRef(null);
|
||||||
|
|
||||||
const saveNotification = async () => {
|
const saveNotification = async () => {
|
||||||
const dismissKey = dismissKeyRef.current.value;
|
const dismissKey = dismissKeyRef.current.value;
|
||||||
const title = titleRef.current.value;
|
const title = titleRef.current.value;
|
||||||
const text = textRef.current.value;
|
const text = textRef.current.value;
|
||||||
|
const startAt = new Date(startAtRef.current.value);
|
||||||
|
const stopAt = new Date(stopAtRef.current.value);
|
||||||
|
|
||||||
// Basic validation
|
// Basic validation
|
||||||
if (!dismissKey || !title || !text || !startAt || !stopAt) {
|
if (!dismissKey || !title || !text || !startAt || !stopAt) {
|
||||||
@@ -29,6 +31,11 @@ const NotificationAdd = () => {
|
|||||||
}));
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log('dismissKey: ', dismissKey);
|
||||||
|
console.log('title: ', title);
|
||||||
|
console.log('text: ', text);
|
||||||
|
console.log('startAt: ', startAt);
|
||||||
|
console.log('stopAt: ', stopAt);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
dismissKey,
|
dismissKey,
|
||||||
@@ -122,8 +129,7 @@ const NotificationAdd = () => {
|
|||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
className='fieldInput'
|
className='fieldInput'
|
||||||
selected={startAt}
|
ref={startAtRef}
|
||||||
onChange={date => setStartAt(date)}
|
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
@@ -133,8 +139,7 @@ const NotificationAdd = () => {
|
|||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
className='fieldInput'
|
className='fieldInput'
|
||||||
selected={stopAt}
|
ref={stopAtRef}
|
||||||
onChange={date => setStopAt(date)}
|
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user