Skip to content

Commit

Permalink
feat: 更改api login回傳的資料
Browse files Browse the repository at this point in the history
fix: 修正logout api未將response結束的問題

feat: 新增ionic的CORS資訊

fix: 修正檢查簽核系統更新config回傳資料卻沒更新的問題
  • Loading branch information
Chinlinlee committed Sep 1, 2021
1 parent c7bd7c9 commit 3f475ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion routes/api/Scores/controller/get_isSignOffCanUse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const config = require('../../../../models/NTUNHS/config');

module.exports = async function (req, res) {
let config = require('../../../../models/NTUNHS/config');
return res.send(config.isSignOffLess);
}
8 changes: 4 additions & 4 deletions routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ module.exports =
// Should not cause any errors
if (err) { return next(err); }
if (req.headers['referer'] != undefined && req.headers['referer'].includes('Course_Search')) {
return res.json("success");
return res.json(req.session.stuInfo);
} else if (req.headers['referer'] != undefined && req.headers['referer'].includes('historyScoreChart')) {
let refererSplit = req.req.headers['referer'].split("/");
let redirectUrl = refererSplit[refererSplit.length-1];
return res.json("success");
return res.json(req.session.stuInfo);
} else {
return res.json("success");
return res.json(req.session.stuInfo);
}
});
})(req, res, next);
Expand All @@ -93,7 +93,7 @@ module.exports =
app.get('/api/logout', function (req, res) {
req.logout();
req.session.destroy();
res.redirect('/');
res.end();
});

app.get('/api/user', My_Func.IsLoggedIn, function (req, res) {
Expand Down
5 changes: 4 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ app.use(flash());
app.use(cors({
origin : [
"http://localhost:4200" ,
"http://127.0.0.1:3001"
"http://127.0.0.1:3001",
"capacitor://localhost",
"http://localhost",
"http://localhost:8100"
] ,
credentials : true
}));
Expand Down

0 comments on commit 3f475ee

Please sign in to comment.