Use a post route for metadata so we can request paths that are more than one layer deep

This commit is contained in:
Kevin MacMartin 2024-04-22 20:46:55 -04:00
parent c2e59f2e32
commit 2d8fc06dae
3 changed files with 7 additions and 7 deletions

View File

@ -11,16 +11,16 @@
class ApiController extends Controller {
public function getMeta($path = null)
{
return Meta::getData($path);
}
public function getBlogEntries()
{
return Blog::getBlogEntries();
}
public function postMeta()
{
return Meta::getData(request()->path);
}
public function postContactSubmit(Request $request)
{
$request->validate([

View File

@ -60,7 +60,7 @@ export default {
},
fetchMetadata() {
this.$http.get(`/api/meta${this.$route.path}${env.apiToken}`).then((response) => {
this.$http.post(`/api/meta${env.apiToken}`, { path: this.$route.path }).then((response) => {
this.updateMetadata(response.data);
}).catch((error) => {
console.log("error fetching metadata");

View File

@ -10,7 +10,6 @@
*/
Route::get('/blog-entries', 'App\Http\Controllers\ApiController@getBlogEntries');
Route::get('/meta/{path?}', 'App\Http\Controllers\ApiController@getMeta');
/*
|--------------------------------------------------------------------------
@ -18,5 +17,6 @@
|--------------------------------------------------------------------------
*/
Route::post('/meta', 'App\Http\Controllers\ApiController@postMeta');
Route::post('/contact-submit', 'App\Http\Controllers\ApiController@postContactSubmit');
Route::post('/subscription-submit', 'App\Http\Controllers\ApiController@postSubscriptionSubmit');