fix: snackbar for profile component (#588)
This commit is contained in:
@@ -58,12 +58,13 @@
|
|||||||
|
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let message = error.message;
|
let message = error instanceof Error ? error.message : `${error}`;
|
||||||
if (message.includes('profile_username_key')) {
|
if (message.includes('profile_username_key')) {
|
||||||
message = $t('username already exists');
|
message = $t('username already exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
snackbar.error(`snackbar.lms.error.update: ${message}`);
|
snackbar.error(`${$t('snackbar.lms.error.update')}: ${message}`);
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
} finally {
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
@@ -73,18 +74,18 @@
|
|||||||
$: locale = $profile.locale;
|
$: locale = $profile.locale;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Grid class="border-c rounded border-gray-200 dark:border-neutral-600 w-full mt-5">
|
<Grid class="border-c mt-5 w-full rounded border-gray-200 dark:border-neutral-600">
|
||||||
<Row class="flex flex-col lg:flex-row items-center lg:items-start py-7 border-bottom-c ">
|
<Row class="border-bottom-c flex flex-col items-center py-7 lg:flex-row lg:items-start ">
|
||||||
<Column sm={4} md={8} lg={4} class="mt-2 md:mt-0">
|
<Column sm={4} md={8} lg={4} class="mt-2 md:mt-0">
|
||||||
<p class="dark:text-white font-bold">{$t('settings.profile.profile_picture.heading')}</p>
|
<p class="font-bold dark:text-white">{$t('settings.profile.profile_picture.heading')}</p>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={2} md={4} lg={8} class="mt-2 lg:mt-0">
|
<Column sm={2} md={4} lg={8} class="mt-2 lg:mt-0">
|
||||||
<UploadImage bind:avatar src={$profile.avatar_url} widthHeight="w-16 h-16 lg:w-24 lg:h-24" />
|
<UploadImage bind:avatar src={$profile.avatar_url} widthHeight="w-16 h-16 lg:w-24 lg:h-24" />
|
||||||
</Column>
|
</Column>
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="flex flex-col lg:flex-row py-7 border-bottom-c">
|
<Row class="border-bottom-c flex flex-col py-7 lg:flex-row">
|
||||||
<Column sm={4} md={4} lg={4}>
|
<Column sm={4} md={4} lg={4}>
|
||||||
<p class="dark:text-white font-bold">{$t('settings.profile.personal_information.heading')}</p>
|
<p class="font-bold dark:text-white">{$t('settings.profile.personal_information.heading')}</p>
|
||||||
</Column>
|
</Column>
|
||||||
<Column sm={8} md={8} lg={8} class="mt-2 lg:mt-0">
|
<Column sm={8} md={8} lg={8} class="mt-2 lg:mt-0">
|
||||||
<TextField
|
<TextField
|
||||||
@@ -110,7 +111,7 @@
|
|||||||
/>
|
/>
|
||||||
</Column>
|
</Column>
|
||||||
</Row>
|
</Row>
|
||||||
<Row class="m-5 w-full flex items-center gap-2 lg:justify-center">
|
<Row class="m-5 flex w-full items-center gap-2 lg:justify-center">
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
label={$t('settings.profile.update_profile')}
|
label={$t('settings.profile.update_profile')}
|
||||||
variant={VARIANTS.CONTAINED_DARK}
|
variant={VARIANTS.CONTAINED_DARK}
|
||||||
|
|||||||
@@ -71,11 +71,12 @@
|
|||||||
hasUnsavedChanges = false;
|
hasUnsavedChanges = false;
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
let message = error.message;
|
let message = error instanceof Error ? error.message : `${error}`;
|
||||||
if (message.includes('profile_username_key')) {
|
if (message.includes('profile_username_key')) {
|
||||||
message = $t('snackbar.lms.error.username_exists');
|
message = $t('snackbar.lms.error.username_exists');
|
||||||
}
|
}
|
||||||
snackbar.error(`${$t('snackbar.lms.error.update')} ${message}`);
|
snackbar.error(`${$t('snackbar.lms.error.update')}: ${message}`);
|
||||||
|
|
||||||
loading = false;
|
loading = false;
|
||||||
} finally {
|
} finally {
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user