質問編集履歴

1

/api/prefecture/list へのアクセスでエラーが出ているようでしたので、APIのルーティングの方を追記いたしました。

2021/02/27 15:05

投稿

jetstream
jetstream

スコア65

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,147 @@
67
67
  DevTools failed to load SourceMap: Could not parse content for https://sumachira.jp/js/popper.js.map: Unexpected token < in JSON at position 0
68
68
 
69
69
  ```
70
+
71
+ /api/prefecture/list へのアクセスでエラーが出ているようでしたので、APIのルーティングの方を追記いたしました。
72
+
73
+ Laravelのバージョンは7.30.0になります。
74
+
75
+
76
+
77
+ /routes/api.php
78
+
79
+ ```
80
+
81
+ <?php
82
+
83
+
84
+
85
+ use Illuminate\Http\Request;
86
+
87
+ use Illuminate\Support\Facades\Route;
88
+
89
+
90
+
91
+ /*
92
+
93
+ |--------------------------------------------------------------------------
94
+
95
+ | API Routes
96
+
97
+ |--------------------------------------------------------------------------
98
+
99
+ |
100
+
101
+ | Here is where you can register API routes for your application. These
102
+
103
+ | routes are loaded by the RouteServiceProvider within a group which
104
+
105
+ | is assigned the "api" middleware group. Enjoy building your API!
106
+
107
+ |
108
+
109
+ */
110
+
111
+
112
+
113
+ Route::group(['middleware' => 'auth:sanctum'], function(){
114
+
115
+ /**
116
+
117
+ * Prefecture API
118
+
119
+ */
120
+
121
+
122
+
123
+ Route::get('/prefecture/list','PrefectureController@show');
124
+
125
+
126
+
127
+ /**
128
+
129
+ * City API
130
+
131
+ */
132
+
133
+
134
+
135
+ Route::get('/city/{prefecture_id}/list','CityController@show');
136
+
137
+
138
+
139
+ /**
140
+
141
+ * Store API
142
+
143
+ */
144
+
145
+ // Store lookup
146
+
147
+ Route::get('/store','StoreController@storeById');
148
+
149
+ Route::get('/store/{city_id}/list','StoreController@show');
150
+
151
+ Route::get('/store/nearby','StoreController@showNearByStore');
152
+
153
+ // Product in store
154
+
155
+ Route::get('/store/{store_id}/product','StoreController@showProduct');
156
+
157
+ Route::get('/store/{store_id}/bargain-product','StoreController@showBargainProduct');
158
+
159
+ Route::get('/store/{store_id}/coupon-product','StoreController@showCouponProduct');
160
+
161
+ Route::get('/store/{store_id}/reserved-product','StoreController@showReservedProduct');
162
+
163
+ Route::get('/store/{store_id}/product/{product_id}', 'StoreController@getProductDetail');
164
+
165
+ // Favorite
166
+
167
+ Route::get('/store/favorite','StoreController@showFavoriteStores');
168
+
169
+ Route::post('/store/favorite/add','StoreController@addFavoriteStore');
170
+
171
+ Route::delete('/store/favorite/remove','StoreController@removeFavoriteStore');
172
+
173
+ // Reservation
174
+
175
+ Route::post('/store/make-reservation','StoreController@makeReservation');
176
+
177
+ Route::get('/store/{store_id}/reservation','StoreController@showBookingReservedProduct');
178
+
179
+ /*
180
+
181
+ shopping cart
182
+
183
+ */
184
+
185
+ Route::get('/store/shopping-cart','StoreController@showShoppingCartList');
186
+
187
+ Route::post('/store/add-to-shopping-cart','StoreController@addToShoppingCartList');
188
+
189
+ Route::post('/store/remove-from-shopping-cart','StoreController@removeFromShoppingCartList');
190
+
191
+
192
+
193
+ /*
194
+
195
+ Use Coupon
196
+
197
+ */
198
+
199
+ Route::get('/store/use-coupon','StoreController@showUseCouponList');
200
+
201
+ Route::post('/store/add-to-use-coupon','StoreController@addToUseCoupon');
202
+
203
+ Route::post('/store/remove-from-use-coupon','StoreController@removeFromUseCoupon');
204
+
205
+
206
+
207
+ Route::post('/store/register_user/add','StoreController@addUserToStore');
208
+
209
+
210
+
211
+ });
212
+
213
+ ```