Skip to content

Commit

Permalink
fix: validation on profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed May 6, 2024
1 parent dac5de8 commit 9c658ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions frontend/src/components/modals/AvatarChangeModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const props = defineProps<{
csrfToken?: string;
}>();
const v = useVuelidate({ $stopPropagation: true });
const selectedFile = ref();
const cropperInput = ref();
const cropperResult = ref();
Expand Down Expand Up @@ -105,6 +106,7 @@ function changeImage({ canvas }: CropperResult) {
}
async function save() {
if (!(await v.value.$validate())) return;
const form = new FormData();
form.append("avatar", cropperResult.value);
if (props.csrfToken) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/pages/auth/settings/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ async function saveProfile() {
<div v-for="(link, idx) in profileForm.socials" :key="link[0]" class="flex items-center mt-2">
<span class="w-25">{{ linkTypes.find((e) => e.value === link[0])?.text }}</span>
<div class="w-75">
<InputText v-model="link[1]" label="Username" :rules="[required()]" />
<InputText v-if="link[0] === 'website'" v-model="link[1]" label="URL" :rules="[required(), validUrl()]" />
<InputText v-else v-model="link[1]" label="Username" :rules="[required()]" />
</div>
<IconMdiBin class="ml-2 w-6 h-6 cursor-pointer hover:color-red" @click="removeLink(idx)" />
</div>
Expand Down

0 comments on commit 9c658ce

Please sign in to comment.