Skip to content
Snippets Groups Projects
Commit ec576507 authored by Petar Hristov's avatar Petar Hristov :speech_balloon:
Browse files

Merge branch 'dev' into 'main'

Dev

See merge request !261
parents 839cd5aa bd6b8ac4
No related branches found
No related tags found
1 merge request!261Dev
Pipeline #1075342 passed
...@@ -136,7 +136,7 @@ export default { ...@@ -136,7 +136,7 @@ export default {
}, },
specific: { specific: {
title: "Ein Fehler ist aufgetreten", title: "Ein Fehler ist aufgetreten",
body: "Es ist ein Fehler aufgetreten {error}. Bitte versuchen Sie es erneut. Falls der Fehler weiterhin auftritt, wenden Sie sich bitte an Ihre Organization.", body: "Es ist ein Fehler aufgetreten {error}. Bitte versuchen Sie es erneut. Falls der Fehler weiterhin auftritt, wenden Sie sich bitte an Ihre Organization und geben Sie die folgende Fehler-ID an: {errorId}.",
}, },
}, },
}, },
......
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
}, },
specific: { specific: {
title: "An error occurred", title: "An error occurred",
body: "An error occurred {error}. Please try again. If the error persists, please contact your organization.", body: "Something went wrong {error}. Please try again. If the issue persists, contact your organization and provide the following Error ID: {errorId}.",
}, },
}, },
}, },
......
...@@ -2,43 +2,43 @@ import type { OrganizationDto } from "@coscine/api-client/dist/types/Coscine.Api ...@@ -2,43 +2,43 @@ import type { OrganizationDto } from "@coscine/api-client/dist/types/Coscine.Api
export const defaultOrganizations: OrganizationDto[] = [ export const defaultOrganizations: OrganizationDto[] = [
{ {
name: "FH Aachen", displayName: "FH Aachen",
rorUri: "https://ror.org/04tqgg260", uri: "https://ror.org/04tqgg260",
}, },
{ {
name: "Karlsruhe Institute of Technology", displayName: "Karlsruhe Institute of Technology",
rorUri: "https://ror.org/04t3en479", uri: "https://ror.org/04t3en479",
}, },
{ {
name: "RWTH Aachen University", displayName: "RWTH Aachen University",
rorUri: "https://ror.org/04xfq0f34", uri: "https://ror.org/04xfq0f34",
}, },
{ {
name: "Technical University of Munich", displayName: "Technical University of Munich",
rorUri: "https://ror.org/02kkvpp62", uri: "https://ror.org/02kkvpp62",
}, },
{ {
name: "TU Darmstadt", displayName: "TU Darmstadt",
rorUri: "https://ror.org/05n911h24", uri: "https://ror.org/05n911h24",
}, },
{ {
name: "TU Dortmund University", displayName: "TU Dortmund University",
rorUri: "https://ror.org/01k97gp34", uri: "https://ror.org/01k97gp34",
}, },
{ {
name: "Universitätsklinikum Aachen", displayName: "Universitätsklinikum Aachen",
rorUri: "https://ror.org/02gm5zw39", uri: "https://ror.org/02gm5zw39",
}, },
{ {
name: "University of Cologne", displayName: "University of Cologne",
rorUri: "https://ror.org/00rcxh774", uri: "https://ror.org/00rcxh774",
}, },
{ {
name: "University of Duisburg-Essen", displayName: "University of Duisburg-Essen",
rorUri: "https://ror.org/04mz5ra38", uri: "https://ror.org/04mz5ra38",
}, },
{ {
name: "University of Münster", displayName: "University of Münster",
rorUri: "https://ror.org/00pd74e08", uri: "https://ror.org/00pd74e08",
}, },
]; ];
import { defineStore } from "pinia"; import { defineStore } from "pinia";
import { NotificationState, NotificationToast } from "./types"; import { type CoscineErrorResponse, NotificationState, NotificationToast } from "./types";
import i18n from "@/plugins/vue-i18n"; import i18n from "@/plugins/vue-i18n";
import { getReasonPhrase } from "http-status-codes"; import { getReasonPhrase } from "http-status-codes";
import type { AxiosError } from "axios"; import type { AxiosError } from "axios";
...@@ -44,12 +44,15 @@ export const useNotificationStore = defineStore({ ...@@ -44,12 +44,15 @@ export const useNotificationStore = defineStore({
postApiErrorNotification(error: AxiosError) { postApiErrorNotification(error: AxiosError) {
let notification: NotificationToast; let notification: NotificationToast;
if (error.response) { if (error.response) {
const coscineErrorResponse = error.response.data as CoscineErrorResponse;
// The request was made and the server responded with a status code that falls out of the range of 2xx // The request was made and the server responded with a status code that falls out of the range of 2xx
const notificationBody = i18n const notificationBody = i18n
.t("toast.apiError.specific.body", { .t("toast.apiError.specific.body", {
error: `(${error.response.status}: ${getReasonPhrase( error: `(${error.response.status}: ${getReasonPhrase(
error.response.status error.response.status
)})`, )})`,
errorId: coscineErrorResponse.data.errorId ?? "",
}) })
.toString(); .toString();
notification = { notification = {
......
...@@ -42,3 +42,13 @@ export interface NotificationState { ...@@ -42,3 +42,13 @@ export interface NotificationState {
*/ */
notificationQueue: NotificationToast[]; notificationQueue: NotificationToast[];
} }
export interface CoscineErrorResponse {
data: {
status: number;
instance: string;
errorId: string;
};
statusCode: number;
isSuccess: boolean;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment