From 30daf7fa670d001f2c2f9645b059a0f95d0ade3d Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Fri, 10 Jan 2025 14:50:31 +0800 Subject: [PATCH] fixed token and fixed pdp fallback name --- innopacks/front/resources/js/app.js | 2 +- .../front/resources/views/products/show.blade.php | 10 +++++----- innopacks/panel/resources/js/app.js | 8 ++------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/innopacks/front/resources/js/app.js b/innopacks/front/resources/js/app.js index b9d5f37e..0000366e 100644 --- a/innopacks/front/resources/js/app.js +++ b/innopacks/front/resources/js/app.js @@ -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); diff --git a/innopacks/front/resources/views/products/show.blade.php b/innopacks/front/resources/views/products/show.blade.php index 54766ca6..7fcb10b5 100644 --- a/innopacks/front/resources/views/products/show.blade.php +++ b/innopacks/front/resources/views/products/show.blade.php @@ -60,7 +60,7 @@
-

{{ $product->translation->name }}

+

{{ $product->fallbackName() }}

@hookupdate('front.product.show.price')
{{ $sku['price_format'] }} @@ -75,7 +75,7 @@
{{ __('front/product.out_stock') }}
-
{{ $product->translation->summary }}
+
{{ $product->fallbackName('summary') }}
  • {{ __('front/product.sku_code') }}: {{ $category->translation->name }}{{ !$loop->last ? ', ' :
- @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') !!}
@if($attributes) diff --git a/innopacks/panel/resources/js/app.js b/innopacks/panel/resources/js/app.js index 53ff80e4..0df12950 100644 --- a/innopacks/panel/resources/js/app.js +++ b/innopacks/panel/resources/js/app.js @@ -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, } });