From a6904524db937b46275f503240f2c24611384abe Mon Sep 17 00:00:00 2001 From: jableader Date: Sat, 18 Oct 2025 12:42:23 +1100 Subject: [PATCH] Refactor #3 --- .editorconfig | 12 ++++++++++++ .prettierrc.json | 7 +++++++ refactor-strategy.md | 6 ++++-- src/api/meals.js | 13 +++++++++++++ src/api/persons.js | 4 ++++ src/components/LoginPage.vue | 7 ++++--- src/components/meals/EditMealPage.vue | 12 +++++++----- src/components/meals/PersonList.vue | 4 ++-- src/components/shopping/MyShoppingPage.vue | 4 +++- src/composables/useAuth.js | 22 ++++++++++++++++++++++ 10 files changed, 78 insertions(+), 13 deletions(-) create mode 100644 .editorconfig create mode 100644 .prettierrc.json create mode 100644 src/composables/useAuth.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..1014ba7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..e809346 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "semi": false, + "trailingComma": "es5", + "printWidth": 100, + "arrowParens": "always" +} diff --git a/refactor-strategy.md b/refactor-strategy.md index d3ff5ab..4210b9e 100644 --- a/refactor-strategy.md +++ b/refactor-strategy.md @@ -31,14 +31,14 @@ Outcome: Routing logic is centralized and testable; pages redirect consistently Outcome: Feature modules call cohesive services; logic for mapping/normalization is isolated and testable. ### Phase 3 — Composables (UI-Facing Logic) -- [ ] Add `src/composables/useAuth.js` (user ref, ensureAuth) +- [x] Add `src/composables/useAuth.js` (user ref, ensureAuth) - [ ] Add `src/composables/useMeals.js` (fetch and mutate meals) - [ ] Refactor pages to use composables and `