Skip to content

Commit

Permalink
fixed token and fixed pdp fallback name
Browse files Browse the repository at this point in the history
  • Loading branch information
yushine committed Jan 10, 2025
1 parent 09d3a6a commit 30daf7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion innopacks/front/resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import './bootstrap-validation';
import './footer';
import './header';

const apiToken = $('meta[name="api-token"]').val();
const apiToken = $('meta[name="api-token"]').attr('content');
axios.defaults.headers.common['Authorization'] = 'Bearer ' + apiToken;
console.log('apiToken:' + apiToken);

Expand Down
10 changes: 5 additions & 5 deletions innopacks/front/resources/views/products/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</div>
<div class="col-12 col-lg-6">
<div class="product-info">
<h1 class="product-title">{{ $product->translation->name }}</h1>
<h1 class="product-title">{{ $product->fallbackName() }}</h1>
@hookupdate('front.product.show.price')
<div class="product-price">
<span class="price">{{ $sku['price_format'] }}</span>
Expand All @@ -75,7 +75,7 @@
<div class="out-stock badge d-none">{{ __('front/product.out_stock') }}</div>
</div>

<div class="sub-product-title">{{ $product->translation->summary }}</div>
<div class="sub-product-title">{{ $product->fallbackName('summary') }}</div>

<ul class="product-param">
<li class="sku"><span class="title">{{ __('front/product.sku_code') }}:</span> <span
Expand Down Expand Up @@ -151,10 +151,10 @@ class="text-dark">{{ $category->translation->name }}</a>{{ !$loop->last ? ', ' :
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="product-description-description">
@if($product->translation->selling_point)
{!! parsedown($product->translation->selling_point) !!}
@if($product->fallbackName('selling_point'))
{!! parsedown($product->fallbackName('selling_point')) !!}
@endif
{!! $product->translation->content !!}
{!! $product->fallbackName('content') !!}
</div>

@if($attributes)
Expand Down
8 changes: 2 additions & 6 deletions innopacks/panel/resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ window.inno = common;
import dominateColor from "./dominate_color";
window.dominateColor = dominateColor;

$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
const apiToken = $('meta[name="api-token"]').val();
const apiToken = $('meta[name="api-token"]').attr('content');
axios.defaults.headers.common['Authorization'] = 'Bearer ' + apiToken;
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
'Authorization' : 'Bearer ' + apiToken,
}
});
Expand Down

0 comments on commit 30daf7f

Please sign in to comment.