This repository was archived by the owner on Jul 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ section
6363 nuxt-link( to ='/example/audio' , no-prefetch ) audio
6464 p
6565 nuxt-link( to ='/example/video' , no-prefetch ) video
66+ p
67+ nuxt-link( to ='/example/server-side-set-cookie' , no-prefetch ) server-side-set-cookie
6668</template >
6769
6870<script lang="ts">
Original file line number Diff line number Diff line change 1+ <template lang="pug">
2+ section
3+ h1.title
4+ | server-side-set-cookie
5+ </template >
6+
7+ <script lang="ts">
8+ import { Component , Vue } from ' nuxt-property-decorator'
9+ import { AxiosRequestConfig } from ' axios'
10+
11+ @Component
12+ export default class ServerSideSetCookie extends Vue {
13+ public async mounted() {
14+ await this .$axios .$post (
15+ ' http://localhost:5000/set-cookie' ,
16+ {
17+ token: ' hoge'
18+ },
19+ {
20+ // withCredentials をつけることで XHR 時に Set-Cookie を許可できる
21+ withCredentials: true
22+ } as AxiosRequestConfig
23+ )
24+
25+ // const xhr = new XMLHttpRequest()
26+ // xhr.open('POST', 'http://localhost:5000/set-cookie', true)
27+ // xhr.withCredentials = true
28+ // xhr.send('token=bar')
29+ }
30+
31+ public head() {
32+ return {
33+ title: ' server-side-set-cookie'
34+ }
35+ }
36+ }
37+ </script >
38+
39+ <style lang="scss" scoped>
40+ h2 {
41+ color : crimson ;
42+ }
43+ </style >
You can’t perform that action at this time.
0 commit comments