Skip to content

Commit

Permalink
fix: fix form
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Nov 24, 2024
1 parent e4b2e83 commit 9cb595b
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions apps/ui/src/views/Settings/EmailNotifications.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { EmailSubscriptionType } from '@/types';
useTitle('Email notifications');
const CREATE_SUBSCRIBE_FORM_STATE = {
const SUBSCRIBE_FORM_STATE = {
email: '',
subscriptions: []
};
Expand All @@ -15,12 +15,13 @@ const DEFINITION = {
type: 'object',
title: 'Email subscription',
additionalProperties: false,
required: ['email'],
required: [],
properties: {
email: {
type: 'string',
format: 'email',
title: 'Email',
maxLength: 256,
examples: ['e.g. [email protected]']
},
subscriptions: {
Expand All @@ -39,7 +40,7 @@ const SUBSCRIPTIONS_TYPE = [
key: 'summary',
title: 'Weekly summary',
description:
'Get a weekly report detailing the activity in your followed spaces.'
'Get a weekly report detailing the activities in your followed spaces.'
},
{
key: 'newProposal',
Expand All @@ -59,24 +60,25 @@ const SUBSCRIPTIONS_TYPE = [
const usersStore = useUsersStore();
const { web3 } = useWeb3();
const user = computed(() => usersStore.getUser(web3.value.account));
const loading = computed(
() => web3.value.authLoading || usersStore.users[web3.value.account]?.loading
);
const form: Ref<{
const form = ref<{
email: string;
subscriptions: EmailSubscriptionType[];
}> = ref(clone(CREATE_SUBSCRIBE_FORM_STATE));
}>(clone(SUBSCRIBE_FORM_STATE));
const formErrors = ref<Record<string, any>>({});
const formValidated = ref(false);
const subscriptions = reactive<Record<EmailSubscriptionType, boolean>>({
summary: true,
newProposal: true,
closedProposal: true
});
const formErrors = ref({} as Record<string, any>);
const formValidated = ref(false);
function handleCreateSubscribeClick() {}
const user = computed(() => usersStore.getUser(web3.value.account));
const loading = computed(
() => web3.value.authLoading || usersStore.users[web3.value.account]?.loading
);
function handleCreateSubscriptionClick() {}
function handleResendConfirmationClick() {}
Expand Down Expand Up @@ -125,12 +127,14 @@ watchEffect(async () => {
</div>

<div class="s-box">
<UiForm
:error="formErrors"
:model-value="form"
:definition="DEFINITION"
<UiInputString
v-model="form.email"
:error="formErrors.email"
:definition="DEFINITION.properties.email"
/>
<UiButton @click="handleCreateSubscribeClick">Subscribe now</UiButton>
<UiButton @click="handleCreateSubscriptionClick">
Subscribe now
</UiButton>
</div>
</template>

Expand Down

0 comments on commit 9cb595b

Please sign in to comment.