Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #291 from tiki/fix/Account-form-error-is-not-reactive
Browse files Browse the repository at this point in the history
Fix/account form error is not reactive
  • Loading branch information
mike-audi authored Oct 6, 2023
2 parents 0c4cbbe + b2c3369 commit d158156
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

3 changes: 1 addition & 2 deletions src/components/account/account-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ watch(
@input="update"
/>
<div class="error">
<p v-if="error" class="error-message">{{ error }}</p>
<p v-if="errorMessage" class="error-message">{{ errorMessage }}</p>
</div>
</form>
</template>
Expand Down Expand Up @@ -109,7 +109,6 @@ input {

.error-message {
margin: 0;
line-height: 0;
}

input:focus {
Expand Down
12 changes: 7 additions & 5 deletions src/components/sheet/sheet-add-retailer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
- Copyright (c) TIKI Inc.
- MIT license. See LICENSE file in root directory.
-->

<script setup lang="ts">
import AccountSelect from "../account/account-select.vue";
import AccountForm from "../account/account-form.vue";
import HeaderBack from "@/components/header/header-back.vue";
import TextButton from "@/components/button/button-text.vue";
import { type Account, AMAZON } from "@mytiki/capture-receipt-capacitor";
import { type Account, ACME_MARKETS } from "@mytiki/capture-receipt-capacitor";
import type { TikiService } from "@/service";
import { ref, inject, computed } from "vue";
import { ButtonTextState } from "@/components/button/button-text-state";

const emit = defineEmits(["close", "back"]);
const tiki: TikiService = inject("Tiki")!;

const form = ref<Account>({ username: "", password: "", type: AMAZON });
const form = ref<Account>({ username: "", password: "", type: ACME_MARKETS });
const error = ref<string>();

const canSubmit = computed(
Expand All @@ -32,7 +31,7 @@ const submit = async () => {
await tiki.capture.login(form.value);
tiki.capture.scan().catch((error) => console.error(error.toString()));
error.value = "";
form.value = { username: "", password: "", type: AMAZON };
form.value = { username: "", password: "", type: ACME_MARKETS };
emit("back");
} catch (err: any) {
error.value = err.toString();
Expand All @@ -47,7 +46,10 @@ const submit = async () => {
@back="$emit('back')"
@close="$emit('close')"
/>
<account-select v-model:account-type="form.type" />
<account-select
:account-type="form.type"
@update:accountType="(val) => (form.type = val)"
/>
<account-form
v-model:account="form"
:error="error"
Expand Down

0 comments on commit d158156

Please sign in to comment.