Skip to content

Commit

Permalink
Merge pull request #49 from TEAM-ITERVIEW/#48
Browse files Browse the repository at this point in the history
[feat] refreshtoken header로 옮기기
  • Loading branch information
cha2y0ung authored Apr 3, 2024
2 parents b7b3c87 + a567879 commit eebe411
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/controller/historyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { success } from '../module/constant/utils';
import { historyService } from '../service';

const getInterviewList = async (req: Request, res: Response, next: NextFunction) => {
const refreshToken = req.body;
const refreshToken = req.headers['refreshtoken'] as string;
const {sortNum} = req.params;

try {
Expand Down
2 changes: 1 addition & 1 deletion src/controller/interviewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { interviewService } from '../service';

const startInterview = async (req: Request, res: Response, next: NextFunction) => {
const startInterviewDTO: startInterviewDTO = req.body;
const refreshToken = req.body;
const refreshToken = req.headers['refreshtoken'] as string;

try {
const data = await interviewService.startInterview(startInterviewDTO, refreshToken);
Expand Down
2 changes: 1 addition & 1 deletion src/controller/studyNoteController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { success } from '../module/constant/utils';
import { studyNoteService } from '../service';

const getStudyNote = async (req: Request, res: Response, next: NextFunction) => {
const refreshToken = req.body;
const refreshToken = req.headers['refreshtoken'] as string;
const sortNum = +req.params.sortNum;
const subjectText = req.query.subjectText as string;
const onlyWrong = req.query.onlyWrong === 'true';
Expand Down
6 changes: 2 additions & 4 deletions src/controller/userController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { success } from '../module/constant/utils';
import { userService } from '../service';

const accessUserInfo = async (req: Request, res: Response, next: NextFunction) => {
const refreshToken = req.body;

const refreshToken = req.headers['refreshtoken'] as string;
try {
const data = await userService.accessUserInfo(refreshToken);

Expand All @@ -18,9 +17,8 @@ const accessUserInfo = async (req: Request, res: Response, next: NextFunction) =
};

const updateUserInfo = async (req: Request, res: Response, next: NextFunction) => {
const refreshToken = req.body.refreshToken;
const refreshToken = req.headers['refreshtoken'] as string;
const themeColor = req.body.themeColor;

try {
const data = await userService.updateUserInfo(refreshToken, themeColor);

Expand Down
2 changes: 1 addition & 1 deletion src/router/historyRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ router.get(
'/:sortNum',
[
param('sortNum'),
body('refreshToken').notEmpty(),
header('refreshToken').notEmpty(),
],
errorValidator,
historyController.getInterviewList,
Expand Down
2 changes: 1 addition & 1 deletion src/router/interviewRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const router: Router = Router();
router.post(
'/',
[
body('refreshToken').notEmpty(),
header('refreshToken').notEmpty(),
body('subjectText').notEmpty(),
body('questionNum').notEmpty(),
body('onlyVoice').notEmpty(),
Expand Down
12 changes: 6 additions & 6 deletions src/router/questionRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ router.patch(
);

router.delete(
'/:interviewQuestionId',
[
param('interviewQuestionId').notEmpty(),
],
errorValidator,
questionController.deletePin,
'/:interviewQuestionId',
[
param('interviewQuestionId').notEmpty(),
],
errorValidator,
questionController.deletePin,
)

export default router;
2 changes: 1 addition & 1 deletion src/router/studyNoteRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ router.get(
param('sortNum').notEmpty(),
query('subjectText').notEmpty(),
query('onlyWrong').notEmpty(),
body('refreshToken').notEmpty(),
header('refreshToken').notEmpty(),
],
errorValidator,
studyNoteController.getStudyNote,
Expand Down
4 changes: 2 additions & 2 deletions src/router/userRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const router: Router = Router();
router.get(
'/',
[
body('refreshToken').notEmpty(),
header('refreshToken').notEmpty(),
],
errorValidator,
userController.accessUserInfo,
Expand All @@ -17,7 +17,7 @@ router.get(
router.patch(
'/',
[
body('refreshToken').notEmpty(),
header('refreshToken').notEmpty(),
body('themeColor'),
],
errorValidator,
Expand Down

0 comments on commit eebe411

Please sign in to comment.