回答編集履歴
2
変更
test
CHANGED
@@ -48,7 +48,7 @@
|
|
48
48
|
|
49
49
|
})
|
50
50
|
|
51
|
-
}
|
51
|
+
},
|
52
52
|
|
53
53
|
}
|
54
54
|
|
1
追記
test
CHANGED
@@ -1,3 +1,55 @@
|
|
1
1
|
`getClientName()` 内の `_.find()` が `undefined` を返しているようです。
|
2
2
|
|
3
3
|
`getClientName()` に渡される `cid` の値は `this.clients` のどれかに必ず一致しますか?
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
### 追記
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
`axios` は `Promise` ベースの API です。
|
12
|
+
|
13
|
+
`Promise.all()` を使用すれば、すべてのレスポンスを一度に受け取ることができます。
|
14
|
+
|
15
|
+
以下のコードを試してみてください。
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
```js
|
20
|
+
|
21
|
+
export const actions = {
|
22
|
+
|
23
|
+
load(ctx) {
|
24
|
+
|
25
|
+
Promise.all([
|
26
|
+
|
27
|
+
axios.get("https://api.airtable.com/v0/appxxxxxxxxx/works?api_key=keyxxxxxxxxxxxxxxxx"),
|
28
|
+
|
29
|
+
axios.get("https://api.airtable.com/v0/appxxxxxxxxx/clients?api_key=keyxxxxxxxxxxxxxxxx"),
|
30
|
+
|
31
|
+
axios.get("https://api.airtable.com/v0/appxxxxxxxxx/agency?api_key=keykeyxxxxxxxxxxxxxxxx"),
|
32
|
+
|
33
|
+
])
|
34
|
+
|
35
|
+
.then(responses => {
|
36
|
+
|
37
|
+
console.log(responses)
|
38
|
+
|
39
|
+
ctx.commit('setWorks', responses[0].data.records)
|
40
|
+
|
41
|
+
ctx.commit('setClients', responses[1].data.records)
|
42
|
+
|
43
|
+
ctx.commit('setAgencies', responses[2].data.records)
|
44
|
+
|
45
|
+
}, reason => {
|
46
|
+
|
47
|
+
console.error(reason)
|
48
|
+
|
49
|
+
})
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
```
|