티스토리 뷰
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | //로그인 버튼 클릭시 const login = e => { e.preventDefault(); // alert('로그인'+values.email); const headers = { 'Content-Type' : 'application/json', 'Authorization' : 'JWT fefege..' } // stackoveflow https://stackoverflow.com/questions/44617825/passing-headers-with-axios-post-request-reactjs?rq=1 참조 const data = { email : values.email, pwd : values.pwd } axios.post(`http://[EC2엔트포인트]/member/login`,JSON.stringify(data),{headers}) .then(res => { localStorage.setItem('id',`${res.data.id}`); localStorage.setItem('email',`${res.data.email}`); localStorage.setItem('pwd',`${res.data.pwd}`); localStorage.setItem('name',`${res.data.name}`); localStorage.setItem('grade',`${res.data.grade}`); localStorage.setItem('introduce',res.data.introduce!==null?res.data.introduce:''); localStorage.setItem('fileUrl',res.data.fileUrl!==null?res.data.fileUrl:''); handleClose(); window.location.reload(); }) .catch(e=>{ alert(`login 실패`); }) } | cs |
==============================================================
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /** * MemberController */ @CrossOrigin(origins = "http://123.456.789.123", maxAge = 3600) @RestController @RequestMapping("/member") public class MemberController { @Autowired MemberDTO member; @Autowired ModelMapper modelMapper; @Autowired MemberRepository repo; //로그인 @PostMapping("/login") public MemberDTO login(@RequestBody MemberDTO dto){ System.out.println("=========================MemberController.login()"); System.out.println("넘어온 아이디"+dto.getEmail()+" 넘어온 패스워드"+dto.getPwd()); ISupplier fx = ()->{ return repo.findByEmailAndPwd(dto.getEmail(), dto.getPwd()).orElseThrow(EntityNotFoundException::new); }; return modelMapper.map(fx.get(),MemberDTO.class); // return null; } | cs |
'0. 정보통신' 카테고리의 다른 글
AWS 업로드 용 Spring-Boot war 파일 추출 (0) | 2020.08.27 |
---|---|
[스프링] 메이븐 설정 프로퍼티 (0) | 2020.06.23 |
82537 트래블 ArticleService.java (0) | 2020.06.02 |
82537 트래블 ArticleController.java (0) | 2020.06.02 |
81540. 마이바티스 템플릿 (0) | 2020.05.29 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Python
- React
- database
- Java
- FLASK
- terms
- maven
- vscode
- Django
- jQuery
- SpringBoot
- AWS
- JPA
- Eclipse
- SQLAlchemy
- intellij
- ERD
- docker
- KAFKA
- springMVC
- tensorflow
- Oracle
- JUnit
- Mongo
- Algorithm
- Git
- mariadb
- Mlearn
- COLAB
- nodejs
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함