목록분류 전체보기 (374)
Silver Library (Archived)
Does setState mutate state? setState() does not immediately mutate this. state but creates a pending state transition. Accessing this. state after calling this method can potentially return the existing value. tl;dr state should remain origin, and mutate setState. If you mutate state directly, then setState will return an empty object. The previous state will be polluted with your mutation. Due ..
핵심 요소. CORS policy, fetch, JavaScript, mutation 예시 코드. fetch('https://cors-anywhere.herokuapp.com/' + fileURL, { method: 'GET', headers: { 'Content-Type': 'application/pdf', }, }) .then((response) => response.blob()) .then((blob) => { // Create blob link to download const url = window.URL.createObjectURL( new Blob([blob]), ); const link = document.createElement('a'); link.href = url; link.setAtt..
사실, 이 cors policy 에 대한 구성은 이전 글에서 다뤘었습니다. 당시 content-type 저건 언제 쓸까 하며 알아 보던 중, 알게 된 문제점입니다. [react] 요즘 fetch Auth 구성에 대한 고찰. 코드를 계속 보다보니 느껴진 게, 대체 저건 뭘까? 였습니다. 언제부턴가 TS 와 비슷해지려는 느낌이 보이는 JS 코드들이 보이는데, 역시 2018년을 기점으로 권고안이 달라진 것을 볼 수가 있었습 silverlibrary.tistory.com 왜 표시 되나요? CORS policy 를 위반해서 브라우저가 막고 있어서 그렇습니다. 보안 때문에 이러나요? 네, 그리 보입니다. 자세한 것은 아래를 참고해주세요. 이걸 비유한다면, 윈도우의 UAC 와 유사하다고 보여집니다. "추가 HTTP ..
코드를 계속 보다보니 느껴진 게, 대체 저건 뭘까? 였습니다. 언제부턴가 TS 와 비슷해지려는 느낌이 보이는 JS 코드들이 보이는데, 역시 2018년을 기점으로 권고안이 달라진 것을 볼 수가 있었습니다 (미국 내 쿠키정책). 그리고 이것의 정체가 바로 CORS policy 인데요. 이에 대해 지속적으로 알아보고자 합니다. 아래는 client 측을 기준으로 재구성 한 예시 코드입니다. const loginButtonAsKim = document.getElementById("loginAuthKim") const loginButtonAsRaynor = document.getElementById("loginAuthRaynor") const adminButton = document.getElementById("a..