From d4ef73816038fca71e0ccfaa2d4e8e8e712f9942 Mon Sep 17 00:00:00 2001 From: primakov Date: Tue, 13 Feb 2024 21:09:49 +0300 Subject: [PATCH] check request --- ijl.config.js | 3 ++- src/pages/Journal.tsx | 3 +++ stubs/api/index.js | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ijl.config.js b/ijl.config.js index e50b4be..aeac6a2 100644 --- a/ijl.config.js +++ b/ijl.config.js @@ -17,6 +17,7 @@ module.exports = { }, config: { "journal.socket.url": "ws://localhost", - "journal.socket.path": "/socket.io/" + "journal.socket.path": "/socket.io/", + "journal.back.url": "/api", } } diff --git a/src/pages/Journal.tsx b/src/pages/Journal.tsx index b9f988e..cdfe951 100644 --- a/src/pages/Journal.tsx +++ b/src/pages/Journal.tsx @@ -15,6 +15,7 @@ import { import arrow from '../assets/36-arrow-right.svg'; import { connect, getSocket } from "../socket"; +import { getConfigValue } from '@ijl/cli'; export const Journal = () => { const [lessons, setLessons] = useState(null); @@ -25,6 +26,8 @@ export const Journal = () => { socket.on('lessons', data => { setLessons(data) }) + + fetch(`${getConfigValue('journal.back.url')}/check`) }, []); const [value, setValue] = useState(''); diff --git a/stubs/api/index.js b/stubs/api/index.js index d2cd565..f5d387b 100644 --- a/stubs/api/index.js +++ b/stubs/api/index.js @@ -1,3 +1,7 @@ const router = require('express').Router(); +router.get('/check', function (req, res){ + res.send({ ok: true }) +}) + module.exports = router;