From c250328d26b09b86344046f82898bd31c979ba2e Mon Sep 17 00:00:00 2001 From: chin Date: Fri, 3 Sep 2021 21:18:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=94=A8=E5=AD=B8?= =?UTF-8?q?=E6=9C=9F=E6=88=90=E7=B8=BE=E6=AA=A2=E6=9F=A5=E7=99=BB=E5=85=A5?= =?UTF-8?q?=E7=8B=80=E6=85=8B=E7=9A=84API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/api/stuInfo/controller/get_loginStatus.js | 12 ++++++++++++ routes/api/stuInfo/index.js | 1 + 2 files changed, 13 insertions(+) create mode 100644 routes/api/stuInfo/controller/get_loginStatus.js diff --git a/routes/api/stuInfo/controller/get_loginStatus.js b/routes/api/stuInfo/controller/get_loginStatus.js new file mode 100644 index 0000000..f13f541 --- /dev/null +++ b/routes/api/stuInfo/controller/get_loginStatus.js @@ -0,0 +1,12 @@ +const _ = require('lodash'); +const { getScore } = require('../../Scores/controller/get_Scores'); +module.exports = async function(req ,res) +{ + let { scores, ranks } = await getScore(req); + if (!scores) { + req.flash('error', '學校系統逾時,請重新登入'); + req.logout(); + return res.status(401).send(); + } + return res.status(200).send(); +} \ No newline at end of file diff --git a/routes/api/stuInfo/index.js b/routes/api/stuInfo/index.js index 5dafe37..4b6a625 100644 --- a/routes/api/stuInfo/index.js +++ b/routes/api/stuInfo/index.js @@ -4,5 +4,6 @@ const router = express.Router(); router.get('/' , require('./controller/get_StuInfo')) router.post('/' , require('./controller/post_StuInfo')); +router.get('/loginStatus', require('./controller/get_loginStatus')); module.exports = router;