mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 11:14:06 +00:00
Add HTTP client wrapper and upgrade Axios to v1 (#594)
* refactor: add HTTP client wrapper and upgrade axios to v1 Introduce a thin HTTP wrapper (resources/scripts/http) that centralizes axios configuration, interceptors, and auth header injection. All 43 files now import from the wrapper instead of axios directly, making future library swaps a single-file change. Upgrade axios from 0.30.0 to 1.14.0. * fix: restore window.Ls assignment removed during axios refactor company.js uses window.Ls.set() to persist selected company, which broke after the axios plugin (that set window.Ls) was deleted.
This commit is contained in:
committed by
GitHub
parent
a38f09cf7b
commit
691178857f
10
resources/scripts/customer/stores/payment.js
vendored
10
resources/scripts/customer/stores/payment.js
vendored
@@ -1,6 +1,6 @@
|
||||
import { handleError } from '@/scripts/customer/helpers/error-handling'
|
||||
const { defineStore } = window.pinia
|
||||
import axios from 'axios'
|
||||
import http from '@/scripts/http'
|
||||
|
||||
export const usePaymentStore = defineStore({
|
||||
id: 'customerPaymentStore',
|
||||
@@ -13,7 +13,7 @@ export const usePaymentStore = defineStore({
|
||||
actions: {
|
||||
fetchPayments(params, slug) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/${slug}/customer/payments`, { params })
|
||||
.then((response) => {
|
||||
this.payments = response.data.data
|
||||
@@ -29,7 +29,7 @@ export const usePaymentStore = defineStore({
|
||||
|
||||
fetchViewPayment(params, slug) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/${slug}/customer/payments/${params.id}`)
|
||||
|
||||
.then((response) => {
|
||||
@@ -45,7 +45,7 @@ export const usePaymentStore = defineStore({
|
||||
|
||||
searchPayment(params, slug) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/${slug}/customer/payments`, { params })
|
||||
.then((response) => {
|
||||
this.payments = response.data
|
||||
@@ -60,7 +60,7 @@ export const usePaymentStore = defineStore({
|
||||
|
||||
fetchPaymentModes(params, slug) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/${slug}/customer/payment-method`, { params })
|
||||
.then((response) => {
|
||||
resolve(response)
|
||||
|
||||
Reference in New Issue
Block a user