mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-18 18:54:07 +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
14
resources/scripts/admin/stores/disk.js
vendored
14
resources/scripts/admin/stores/disk.js
vendored
@@ -1,4 +1,4 @@
|
||||
import axios from 'axios'
|
||||
import http from '@/scripts/http'
|
||||
import { defineStore } from 'pinia'
|
||||
import { useNotificationStore } from '@/scripts/stores/notification'
|
||||
import { handleError } from '@/scripts/helpers/error-handling'
|
||||
@@ -71,7 +71,7 @@ export const useDiskStore = (useWindow = false) => {
|
||||
actions: {
|
||||
fetchDiskEnv(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/disks/${data.disk}`)
|
||||
.then((response) => {
|
||||
resolve(response)
|
||||
@@ -85,7 +85,7 @@ export const useDiskStore = (useWindow = false) => {
|
||||
|
||||
fetchDisks(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/disks`, { params })
|
||||
.then((response) => {
|
||||
this.disks = response.data.data
|
||||
@@ -100,7 +100,7 @@ export const useDiskStore = (useWindow = false) => {
|
||||
|
||||
fetchDiskDrivers() {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.get(`/api/v1/disk/drivers`)
|
||||
.then((response) => {
|
||||
this.diskConfigData = response.data
|
||||
@@ -116,7 +116,7 @@ export const useDiskStore = (useWindow = false) => {
|
||||
|
||||
deleteFileDisk(id) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.delete(`/api/v1/disks/${id}`)
|
||||
.then((response) => {
|
||||
if (response.data.success) {
|
||||
@@ -141,7 +141,7 @@ export const useDiskStore = (useWindow = false) => {
|
||||
|
||||
updateDisk(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.put(`/api/v1/disks/${data.id}`, data)
|
||||
.then((response) => {
|
||||
if (response.data) {
|
||||
@@ -166,7 +166,7 @@ export const useDiskStore = (useWindow = false) => {
|
||||
|
||||
createDisk(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios
|
||||
http
|
||||
.post(`/api/v1/disks`, data)
|
||||
.then((response) => {
|
||||
if (response.data) {
|
||||
|
||||
Reference in New Issue
Block a user