vue3 を axios と prisma で使用していますが、ユーザー情報(bào)を取得するのに問題があります。
私の postman リクエストは機(jī)能します (http://localhost:3000/api/auth/user/7) が、axios リクエストは機(jī)能しません。
###手伝ってもらえますか?async が作成されました () { const response = await axios.get('http://localhost:3000/api/auth/user/:id', { ヘッダー: { 認(rèn)可: 'ベアラー' localStorage.getItem('トークン') } }); console.log('ici'); }
解決策の 1 つは、テンプレート文字列を使用してリクエスト URL を構(gòu)築することです。
###例えば:###関數(shù) getID(id) { const response = await axios.get(`http://localhost:3000/api/auth/user/${id}`,{ ヘッダー: { 認(rèn)可: 'ベアラー' localStorage.getItem('トークン') } }); } // getID(7);