kmh
@kmh8919
Reviews Written
-
Average Rating
-
Posts
Q&A
EventResource ๊ฐ์ฒด๋ฅผ ์์ฑํ์ง ์๊ณ EntityModel ๊ฐ์ฒด๋ฅผ ๋ฐ์์์ ์ฒ๋ฆฌํ์ต๋๋ค.
ํน์ ์๋์ ๊ฐ์ด ์ฒ๋ฆฌํ๊ธฐ๋ ํ์์ต๋๋ค. @PostMapping public ResponseEntity createEvent(@RequestBody @Valid EventDto event, Errors errors) { if(errors.hasErrors()) { return ResponseEntity.badRequest().body(errors); } eventValidator.validate(event, errors); if(errors.hasErrors()) { return ResponseEntity.badRequest().body(errors); } Event newEvent = eventRepository.save(modelMapper.map(event, Event.class)); Integer eventId = newEvent.getId(); newEvent.update(); WebMvcLinkBuilder selfLinkBuilder = linkTo(EventController.class).slash(eventId); URI createdUri = selfLinkBuilder.toUri(); List links = Arrays.asList( selfLinkBuilder.slash(eventId).withSelfRel(), selfLinkBuilder.withRel("query-events"), selfLinkBuilder.withRel("update-event") ); EntityModel eventResource = EntityModel.of(newEvent, links); eventResource.add(); eventResource.add(); eventResource.add(selfLinkBuilder.withRel("update-event")); return ResponseEntity.created(createdUri).body(eventResource); }
- 14
- 2
- 554
Q&A
Option ๊ด๋ จ ๋ถ๋ถ ์ง๋ฌธ์ ๋๋ค.
์ฌ๊ธฐ์ ๋๋ฆฌ๋ ์ง๋ฌธ์ ๋ก๊ทธ์ธ์ ์ด์ฐจํผ ์ธ์ฆ๋ ์ ์ ๊ฐ ์ ๊ทผํ๊ฒ ์๋๊ณ ์ธ์ฆํด์ผํ ์ ์ ๊ฐ ์ ๊ทผํดใ ์ผ๋ ํ์ด์ง์ธ๊ฒ ๊ฐ๊ณ api ๋ํ ์์ง์ Authorization ์ธ์ฆ ํ ํฐ์ ๋ฐ์ ์ ์ ๊ฐ ์๋๋ฐ ๋ก๊ทธ์ธ ์์ ๋์ด๊ฐ๋ค! ๋ผ๋๊ฒ ์๋ฌธ์ ์ด์ ๊ฒ ๊ฐ์์. ๋ก๊ทธ์ธ ํ์ด๋ฐ์ ์ธ์ฆํ ํฐ์ ์๊ตฌํ๋ค๋๊ฒ ์ข ์ด์ํ๊ธฐ๋ ํ๊ตฌ์. 1๋ฒ์ ๊ทธ๋ถ๋ถ์ ๋ง์ํ์ ๊ฒ ๊ฐ์์. ์ค์ ๋ก ๊ฐ์์์ request intercept์ ํค๋์ Authorization์ ๋ก๊ทธ์ธ ํ๊ธฐ ์ ์ ๋ค์ด๊ฐ ๊ฒ ๊ฐ๋ค์. -> ๊ฐ์๋ฅผ ์์ธํ ํ์ธํด๋ณด๋ clearUsername์ด๋ผ๋ mutations๋ username๋ง '' ํด๋ฆฌ์ดํ๋ ๊ธฐ๋ฅ์ด๊ณ , ์ด์ ๋ก๊ทธ์ธ์์ token์ ๋ด์๋๋๋ฐ ์๋ก๊ณ ์นจ์ด ์๋๋ผ ๋ก๊ทธ์์ ํ์๊ณ state์ ๋จ์์๋ token์ด ์ด์ ๋ก๊ทธ์ธ ๊ณ์ ์ ํ ํฐ์ด์๊ณ (์ด์ฐจํผ ๊ฐ์ a@a.com ์ด๊ธดํ์ง๋ง) ์ด๊ฒ์ด state์ ์์ง๋จ์์์ด api request๋ฅผ ํ ๋ ํค๋์ ์ค๋ฆฐ๊ฒ ๊ฐ์์. ์ค์ ๋ก๊ทธ์ธ api๋ Authorization์ด ํ์์๋ ๊ฒ ์๋๊ฐ์??
- 1
- 4
- 688
Q&A
Jobs์ ๋ํ APIํธ์ถ ์คํจ
api ์ชฝ์์ ํ๋ฉ์ด ๊ฑธ๋ฆฌ๋ค์ ์ ๋ ใ ใ ๊ทธ๋์ ๊ทธ๋ฅ ๋ฌด์ํ๊ณ ์งํํ์ด์..
- 1
- 2
- 255
Q&A
<router-link> ์ ๊ด๋ จํด ์ง๋ฌธ์์ต๋๋ค!
์๋ ํ์ธ์. card 1 card 2๋ฅผ ํด๋ฆญํด์ ๋ผ์ฐํ ํ ๋๋ง๋ค /b/${bid}์ ํด๋นํ๋ path๊ฐ์ด bid ๊ฐ์ ๋ณํ์ง ์์ง๋ง ๋ธ๋ผ์ฐ์ ์ url์์์ $%7Bbid%7D ๋ค์๊ณผ ๊ฐ์ ๋ฌธ์์ด ํํ๋ก ๋ฐ๋๋๋ฐ ์๊ทธ๋ฌ๋ ๊ฑธ๊น์??
- 1
- 4
- 750




