Skip to content

Commit

Permalink
front fix
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorOlikov committed May 15, 2024
1 parent 1fe645a commit d322918
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class RouteServiceProvider extends ServiceProvider
*
* @var string
*/
public const HOME = '/api/v1/';
public const HOME = '/';

/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
return Limit::perMinute(600)->by($request->user()?->id ?: $request->ip());
});

$this->routes(function () {
Expand Down
22 changes: 16 additions & 6 deletions resources/js/src/pages/CategorySlugProductPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@
</template>

<script setup>
import {onMounted, reactive, ref, provide, onUnmounted, defineAsyncComponent} from "vue";
import {onMounted, reactive, ref, provide, onUnmounted, watch} from "vue";
import {useRoute, useRouter} from "vue-router";
import axios from "axios";
import ProductList from "@/components/ProductList.vue";
import ProductFilter from "@/components/Filter/ProductFilter.vue";
import {useAuthStore} from "@/store/AuthStore.js";
import DefaultFilter from "@/components/Filter/DefaultFilter.vue";
const productsEmpty = ref(false)
Expand All @@ -101,6 +101,7 @@ const categorySlug = route.params.categorySlug;
provide('filter', filterParams)
async function fetchProducts() {
productsEmpty.value = false
try {
const {data} = await axios.get(`${appDomain}${apiVersion}/category/${categorySlug}/product`,{
Expand Down Expand Up @@ -179,9 +180,16 @@ async function selectSort(event) {
}
async function loadMoreProducts() {
offset.value = offset.value + 10
filterParams['offset'] = offset.value
if (products.value.length > 9) {
offset.value = offset.value + 10
filterParams['offset'] = offset.value
} else {
offset.value = 0
filterParams['offset'] = offset.value
}
await fetchProducts()
}
Expand All @@ -208,9 +216,11 @@ onMounted(async () => {
observer.observe(obs.value)
});
onUnmounted(() => {
watch(filterParams, async () => {
await fetchProducts()
}, { deep: true })
})
</script>

Expand Down

0 comments on commit d322918

Please sign in to comment.