{"id":823,"date":"2020-05-25T17:35:24","date_gmt":"2020-05-25T08:35:24","guid":{"rendered":"https:\/\/mattarishitemota.com\/?p=823"},"modified":"2020-05-31T20:01:15","modified_gmt":"2020-05-31T11:01:15","slug":"angular%e3%81%aehttp%e3%82%a4%e3%83%b3%e3%82%bf%e3%83%bc%e3%82%bb%e3%83%97%e3%82%bf%e3%83%bc%e3%81%a7%e3%82%a8%e3%83%a9%e3%83%bc%e3%83%81%e3%82%a7%e3%83%bc%e3%83%b3%e3%81%ae%e9%80%94%e4%b8%ad%e3%81%a7","status":"publish","type":"post","link":"https:\/\/mattarishitemota.com\/?p=823","title":{"rendered":"Angular\u306eHTTP\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30fc\u3067\u3001\u30a8\u30e9\u30fc\u30c1\u30a7\u30fc\u30f3\u306e\u9014\u4e2d\u3067\u629c\u3051\u305f\u3044"},"content":{"rendered":"\n<p>HTTP\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30fc\u3092\u4f7f\u3063\u3066401\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306b\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u3078\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u305f\u3044\u306e\u3060\u304c\u3001\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u3002<\/p>\n\n\n\n<p>\u3069\u3046\u3082\u5f8c\u7d9a\u306e\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30fc\u3067throwError\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u6c17\u304c\u3059\u308b\u3002\u30a8\u30e9\u30fc\u30c1\u30a7\u30fc\u30f3\u3092\u9014\u4e2d\u3067\u629c\u3051\u308b\u306b\u306f\u3069\u3046\u3057\u305f\u3089\u3088\u3044\u306e\u3060\u308d\u3046\u304b\uff1f<\/p>\n\n\n\n<p>\u8a66\u3057\u306bempty observable\u3092\u8fd4\u3057\u3066\u307f\u305f\u306e\u3060\u304c\u3001\u3084\u3063\u3071\u308a\u5f8c\u7d9a\u306e\u30a8\u30e9\u30fc\u51e6\u7406\u306b\u5165\u3063\u3066\u3057\u307e\u3046\u2026\u3002\u3046\u30fc\u3093\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">(2020.05.31\u8ffd\u8a18)<\/h4>\n\n\n\n<p>\u30c1\u30a7\u30fc\u30f3\u3092\u629c\u3051\u3089\u308c\u306a\u3044\u306e\u304c\u539f\u56e0\u306a\u306e\u3067\u306f\u306a\u304f\u3001Router \u306e navigate \u547c\u3073\u51fa\u3057\u304c\u3067\u304d\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u539f\u56e0\u3060\u3063\u305f\u3002\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u3044\u306a\u3044\u306e\u3067\u7591\u3063\u3066\u3044\u306a\u304b\u3063\u305f\u304c\u3001console.log(route) \u3068\u3059\u308b\u3068 undefined &#8230;\u3002<\/p>\n\n\n\n<p>\u4e0b\u8a18\u306e\u611f\u3058\u3067\u547c\u3073\u51fa\u3057\u3066\u3044\u305f\u306e\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5909\u6570\u304c\u53c2\u7167\u3067\u304d\u3066\u3044\u306a\u304b\u3063\u305f\u307f\u305f\u3044\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plane\" data-line=\"4\"><code>  intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler) {\n    return next.handle(req)\n      .pipe(\n        tap(null, this.handleUnauthorizedError)\n      );\n  }<\/code><\/pre><\/div>\n\n\n\n<p>handleUnauthorizedError \u306f\u3053\u3093\u306a\u611f\u3058\u2193<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plane\"><code>  private handleUnauthorizedError(error: HttpErrorResponse) {\n    if (error.status === 401) {\n      this.router.navigate([&#39;\/login&#39;]) \/\/ this.router \u304c undefined \u306b\u306a\u3063\u3066\u3044\u305f\n    }\n  };\n<\/code><\/pre><\/div>\n\n\n\n<p>\u3067\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u4fee\u6b63\u3057\u305f\u3089\u3044\u3051\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plane\" data-line=\"4\"><code>  intercept(req: HttpRequest&lt;any&gt;, next: HttpHandler) {\n    return next.handle(req)\n      .pipe(\n        tap(null, error =&gt; this.handleUnauthorizedError(error))\n      );\n  }<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>HTTP\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30fc\u3092\u4f7f\u3063\u3066401\u30a8\u30e9\u30fc\u306e\u5834\u5408\u306b\u30ed\u30b0\u30a4\u30f3\u753b\u9762\u3078\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3057\u305f\u3044\u306e\u3060\u304c\u3001\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u3002 \u3069\u3046\u3082\u5f8c\u7d9a\u306e\u30a4\u30f3\u30bf\u30fc\u30bb\u30d7\u30bf\u30fc\u3067throwError\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u3066\u3044\u306a\u3044\u6c17\u304c\u3059\u308b\u3002\u30a8\u30e9\u30fc\u30c1\u30a7\u30fc <span class=\"more-text\">&hellip;<\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[9],"tags":[23],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":611,"url":"https:\/\/mattarishitemota.com\/?p=611","url_meta":{"origin":823,"position":0},"title":"Angular\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\uff085.2.11\u21926.x\uff09","author":"Owner","date":"2020\u5e744\u67084\u65e5","format":false,"excerpt":"4\u21925\u306b\u5f15\u304d\u7d9a\u304d\u3001Angular Update Guide \u306b\u5f93\u3044\u5bfe\u5fdc\u3057\u3066\u307f\u308b\u3002 https:\/\/u\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":533,"url":"https:\/\/mattarishitemota.com\/?p=533","url_meta":{"origin":823,"position":1},"title":"Angular\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\uff084.0.1\u21925.x\uff09","author":"Owner","date":"2020\u5e743\u670822\u65e5","format":false,"excerpt":"Angular Update Guide \u306b\u5f93\u3044\u5bfe\u5fdc\u3057\u3066\u307f\u308b\u3002 https:\/\/update.ang\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2597,"url":"https:\/\/mattarishitemota.com\/?p=2597","url_meta":{"origin":823,"position":2},"title":"AngularFire\u3067\u30c7\u30d7\u30ed\u30a4\uff08ng deploy\uff09\u3057\u305f\u304c\u3001\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068404\u30a8\u30e9\u30fc","author":"Owner","date":"2022\u5e749\u67089\u65e5","format":false,"excerpt":"ng deploy \u3057\u3066\u6700\u5f8c\u306b\u8868\u793a\u3055\u308c\u305fURL\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u3001\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u304c\u3002 \u3042\u308c\uff1f\u3068\u601d\u3044\u3001di\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/af7224b4a059effa82d37ec96664163b.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/af7224b4a059effa82d37ec96664163b.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/af7224b4a059effa82d37ec96664163b.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/af7224b4a059effa82d37ec96664163b.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2022\/09\/af7224b4a059effa82d37ec96664163b.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":727,"url":"https:\/\/mattarishitemota.com\/?p=727","url_meta":{"origin":823,"position":3},"title":"\u3053\u306e\u69cb\u6587\u306b\u306f\u30a4\u30f3\u30dd\u30fc\u30c8\u3055\u308c\u305f\u30d8\u30eb\u30d1\u30fc\u304c\u5fc5\u8981\u3067\u3059\u304c\u3001\u30e2\u30b8\u30e5\u30fc\u30eb &#8216;tslib&#8217; \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002","author":"Owner","date":"2020\u5e744\u670825\u65e5","format":false,"excerpt":"Angular \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092 7 \u306b\u3042\u3052\u3066\u304b\u3089\u3060\u3068\u601d\u3046\u306e\u3060\u304c\u3001\u6c17\u3065\u3044\u305f\u3089\u3053\u3093\u306a VSCode \u3067\u30a8\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2020\/04\/tslib-error.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2020\/04\/tslib-error.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2020\/04\/tslib-error.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2020\/04\/tslib-error.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/mattarishitemota.com\/wp-content\/uploads\/2020\/04\/tslib-error.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":801,"url":"https:\/\/mattarishitemota.com\/?p=801","url_meta":{"origin":823,"position":4},"title":"Angular\u3067\u9023\u9396\u7684\u306bWeb API\u3092\u547c\u3073\u51fa\u3057\u305f\u3044","author":"Owner","date":"2020\u5e745\u670819\u65e5","format":false,"excerpt":"\u3053\u3093\u306a\u306e\u3092\u5b9f\u88c5\u3057\u305f\u304b\u3063\u305f\u3002 \u3042\u308bAPI\u3092\u547c\u3093\u3067\u3001\u6210\u529f\u3057\u305f\u3089\u6b21\u306eAPI\u3092\u547c\u3073\u51fa\u3057\u305f\u3044\u3069\u3061\u3089\u304b\u3067\u30a8\u30e9\u30fc\u306b\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":811,"url":"https:\/\/mattarishitemota.com\/?p=811","url_meta":{"origin":823,"position":5},"title":"ng serve \u3060\u3068\u554f\u984c\u306a\u3044\u306e\u306b ng build &#8211;prod \u3060\u3068\u30b3\u30f3\u30d1\u30a4\u30eb\u30a8\u30e9\u30fc","author":"Owner","date":"2020\u5e745\u670823\u65e5","format":false,"excerpt":"\u300c\u3055\u3041\u3044\u3088\u3044\u3088\u30ea\u30ea\u30fc\u30b9\u3060\uff01\u300d\u3068\u601d\u3063\u3066 ng build --prod \u3057\u305f\u3089\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u304c\u3002 ERR\u2026","rel":"","context":"IT","block_context":{"text":"IT","link":"https:\/\/mattarishitemota.com\/?cat=9"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts\/823"}],"collection":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=823"}],"version-history":[{"count":7,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts\/823\/revisions"}],"predecessor-version":[{"id":851,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=\/wp\/v2\/posts\/823\/revisions\/851"}],"wp:attachment":[{"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattarishitemota.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}