質問編集履歴
2
エラー内容とコードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,4 +30,98 @@
|
|
30
30
|
|
31
31
|
他に必要な情報等ありましたら、お手数ですがご指示頂ければと思います。
|
32
32
|
|
33
|
-
|
33
|
+
|
34
|
+
|
35
|
+
__photo:1 Mixed Content: The page at 'https://golden-bear-83769-stg.herokuapp.com/photo' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://golden-bear-83769-stg.herokuapp.com/api/favorite'. This request has been blocked; the content must be served over HTTPS.__
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
|
43
|
+
addFavorite() {
|
44
|
+
|
45
|
+
const form = objectToFormData({user_id: this.user_id})
|
46
|
+
|
47
|
+
post(`/api/favorite/`, form)
|
48
|
+
|
49
|
+
.then((res) => {
|
50
|
+
|
51
|
+
//
|
52
|
+
|
53
|
+
})
|
54
|
+
|
55
|
+
.catch((err) => {
|
56
|
+
|
57
|
+
//
|
58
|
+
|
59
|
+
})
|
60
|
+
|
61
|
+
},
|
62
|
+
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
```javascript
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
export function toMulipartedForm(form, mode) {
|
72
|
+
|
73
|
+
....
|
74
|
+
|
75
|
+
return objectToFormData(form)
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
export function objectToFormData(obj, form, namespace) {
|
82
|
+
|
83
|
+
let fd = form || new FormData()
|
84
|
+
|
85
|
+
let formKey
|
86
|
+
|
87
|
+
for(var property in obj) {
|
88
|
+
|
89
|
+
if(obj.hasOwnProperty(property)) {
|
90
|
+
|
91
|
+
if(namespace) {
|
92
|
+
|
93
|
+
formKey = namespace + '[' + property + ']';
|
94
|
+
|
95
|
+
} else {
|
96
|
+
|
97
|
+
formKey = property;
|
98
|
+
|
99
|
+
}
|
100
|
+
|
101
|
+
if(obj[property] instanceof Array) {
|
102
|
+
|
103
|
+
for (var i = 0; i < obj[property].length; i++) {
|
104
|
+
|
105
|
+
objectToFormData(obj[property][i], fd, `${property}[${i}]`);
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
} else if(typeof obj[property] === 'object' && !(obj[property] instanceof File)) {
|
110
|
+
|
111
|
+
objectToFormData(obj[property], fd, property);
|
112
|
+
|
113
|
+
} else {
|
114
|
+
|
115
|
+
fd.append(formKey, obj[property]);
|
116
|
+
|
117
|
+
}
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
}
|
122
|
+
|
123
|
+
return fd
|
124
|
+
|
125
|
+
}
|
126
|
+
|
127
|
+
```
|
1
エラー内容の追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -21,3 +21,13 @@
|
|
21
21
|
|
22
22
|
|
23
23
|
よろしくお願いいたします。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
追記
|
28
|
+
|
29
|
+
エラー内容については下記になります。
|
30
|
+
|
31
|
+
他に必要な情報等ありましたら、お手数ですがご指示頂ければと思います。
|
32
|
+
|
33
|
+
photo:1 Mixed Content: The page at 'https://golden-bear-83769-stg.herokuapp.com/photo' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://golden-bear-83769-stg.herokuapp.com/api/favorite'. This request has been blocked; the content must be served over HTTPS.
|