Fix label and error handling

This commit is contained in:
Kacper Donat 2020-10-18 14:22:05 +02:00
parent 5879efc978
commit bbf3b864e7
2 changed files with 14 additions and 5 deletions

View File

@ -10,9 +10,13 @@ const EDITION_REGISTER_ENDPOINT = "/register";
const EDITION_LOGIN_ENDPOINT = "/access/loginEdition"; const EDITION_LOGIN_ENDPOINT = "/access/loginEdition";
export async function available() { export async function available() {
const response = await axios.get(EDITIONS_ENDPOINT); try {
const response = await axios.get(EDITIONS_ENDPOINT);
return (response.data || []).map(editionTeaserDtoTransformer.transform); return (response.data || []).map(editionTeaserDtoTransformer.transform);
} catch (e) {
return [];
}
} }
export async function join(key: string): Promise<boolean> { export async function join(key: string): Promise<boolean> {
@ -26,10 +30,14 @@ export async function join(key: string): Promise<boolean> {
} }
export async function get(key: string): Promise<Edition | null> { export async function get(key: string): Promise<Edition | null> {
const response = await axios.get<EditionDTO>(prepare(EDITION_INFO_ENDPOINT, { key })); try {
const dto = response.data; const response = await axios.get<EditionDTO>(prepare(EDITION_INFO_ENDPOINT, { key }));
const dto = response.data;
return editionDtoTransformer.transform(dto); return editionDtoTransformer.transform(dto);
} catch (error) {
return null;
}
} }
export async function current(): Promise<Edition> { export async function current(): Promise<Edition> {

View File

@ -39,6 +39,7 @@ pages:
my-editions: "Moje praktyki" my-editions: "Moje praktyki"
pick: "wybierz" pick: "wybierz"
register: "Zapisz się do edycji praktyk" register: "Zapisz się do edycji praktyk"
no-editions: "Brak edycji do wyboru, zarejestruj się do edycji praktyk przyciskiem poniżej."
user-fill: user-fill:
title: "Uzupełnij swoje dane" title: "Uzupełnij swoje dane"
user-profile: user-profile: