mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-18 22:33:44 +02:00
Support saving existing files
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import axios, {AxiosInstance} from 'axios';
|
||||
import axios, {AxiosError, AxiosInstance} from 'axios';
|
||||
import {ServerApplicationCredentials} from "@/store/types";
|
||||
|
||||
// This token is set in the bootstrap.js file at the beginning of the request
|
||||
@@ -38,3 +38,18 @@ export function withCredentials(server: string, credentials: ServerApplicationCr
|
||||
|
||||
return http;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an error into a human readable response. Mostly just a generic helper to
|
||||
* make sure we display the message from the server back to the user if we can.
|
||||
*/
|
||||
export function httpErrorToHuman(error: any): string {
|
||||
if (error.response && error.response.data) {
|
||||
const { data } = error.response;
|
||||
if (data.errors && data.errors[0] && data.errors[0].detail) {
|
||||
return data.errors[0].detail;
|
||||
}
|
||||
}
|
||||
|
||||
return error.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user