mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 15:22:47 +01:00
Hide userdata fail message (#536)
* Hide userdata fail message * Change axios imports Co-authored-by: Jonas Plum <git@jonasplum.de>
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import {UserData} from "@/client";
|
import {UserData} from "@/client";
|
||||||
import {API} from "@/services/api";
|
import {API} from "@/services/api";
|
||||||
import {AxiosTransformer} from "axios";
|
import {AxiosResponseTransformer} from "axios";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
user?: UserData,
|
user?: UserData,
|
||||||
@@ -46,7 +46,7 @@ export default Vue.extend({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let defaultTransformers = this.axios.defaults.transformResponse as AxiosTransformer[]
|
let defaultTransformers = this.axios.defaults.transformResponse as AxiosResponseTransformer[]
|
||||||
let transformResponse = defaultTransformers.concat((data) => {
|
let transformResponse = defaultTransformers.concat((data) => {
|
||||||
data.notoast = true;
|
data.notoast = true;
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import Vue from "vue";
|
|||||||
import Vuex, {ActionContext} from "vuex";
|
import Vuex, {ActionContext} from "vuex";
|
||||||
import {API} from "@/services/api";
|
import {API} from "@/services/api";
|
||||||
import {UserData, TicketList, UserResponse, SettingsResponse} from "@/client";
|
import {UserData, TicketList, UserResponse, SettingsResponse} from "@/client";
|
||||||
import {AxiosResponse} from "axios";
|
import axios, {AxiosResponse, AxiosResponseTransformer} from "axios";
|
||||||
import {Alert} from "@/types/types";
|
import {Alert} from "@/types/types";
|
||||||
import {templateStore} from "./modules/templates";
|
import {templateStore} from "./modules/templates";
|
||||||
import {socketStore} from "@/store/modules/socket";
|
import {socketStore} from "@/store/modules/socket";
|
||||||
@@ -63,7 +63,12 @@ export default new Vuex.Store({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getUserData (context: ActionContext<any, any>) {
|
getUserData (context: ActionContext<any, any>) {
|
||||||
API.currentUserData().then((response: AxiosResponse<UserData>) => {
|
const defaultTransformers = axios.defaults.transformResponse as AxiosResponseTransformer[]
|
||||||
|
const transformResponse = defaultTransformers.concat((data) => {
|
||||||
|
data.notoast = true;
|
||||||
|
return data
|
||||||
|
});
|
||||||
|
API.currentUserData({transformResponse: transformResponse}).then((response: AxiosResponse<UserData>) => {
|
||||||
context.commit("setUserData", response.data);
|
context.commit("setUserData", response.data);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ import LineChart from "../components/charts/Line";
|
|||||||
import BarChart from "../components/charts/Bar";
|
import BarChart from "../components/charts/Bar";
|
||||||
import PieChart from "../components/charts/Doughnut";
|
import PieChart from "../components/charts/Doughnut";
|
||||||
import {ChartData} from "chart.js";
|
import {ChartData} from "chart.js";
|
||||||
import {AxiosError, AxiosTransformer} from "axios";
|
import {AxiosError, AxiosResponseTransformer} from "axios";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
dashboard?: DashboardResponse;
|
dashboard?: DashboardResponse;
|
||||||
@@ -215,7 +215,7 @@ export default Vue.extend({
|
|||||||
loadWidgetData: function (widgets: Array<Widget>) {
|
loadWidgetData: function (widgets: Array<Widget>) {
|
||||||
this.lodash.forEach(widgets, (widget: Widget, index: number) => {
|
this.lodash.forEach(widgets, (widget: Widget, index: number) => {
|
||||||
let widgetErrors = {};
|
let widgetErrors = {};
|
||||||
let defaultTransformers = this.axios.defaults.transformResponse as AxiosTransformer[]
|
let defaultTransformers = this.axios.defaults.transformResponse as AxiosResponseTransformer[]
|
||||||
let transformResponse = defaultTransformers.concat((data) => {
|
let transformResponse = defaultTransformers.concat((data) => {
|
||||||
data.notoast = true;
|
data.notoast = true;
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import Vue from "vue";
|
|||||||
import { UserData } from "@/client";
|
import { UserData } from "@/client";
|
||||||
import { API } from "@/services/api";
|
import { API } from "@/services/api";
|
||||||
import UserDataEditor from "@/components/UserDataEditor.vue";
|
import UserDataEditor from "@/components/UserDataEditor.vue";
|
||||||
|
import axios, {AxiosResponseTransformer} from "axios";
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
userdata?: UserData;
|
userdata?: UserData;
|
||||||
@@ -34,7 +35,12 @@ export default Vue.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadUserData: function () {
|
loadUserData: function () {
|
||||||
API.currentUserData().then((response) => {
|
const defaultTransformers = axios.defaults.transformResponse as AxiosResponseTransformer[]
|
||||||
|
const transformResponse = defaultTransformers.concat((data) => {
|
||||||
|
data.notoast = true;
|
||||||
|
return data
|
||||||
|
});
|
||||||
|
API.currentUserData({transformResponse: transformResponse}).then((response) => {
|
||||||
this.userdata = response.data;
|
this.userdata = response.data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user