fix: plans store使用api()替代不存在的requestJSON
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 17s
Test / e2e-test (push) Successful in 50s
All checks were successful
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 5s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 5s
PR Preview / deploy-preview (pull_request) Successful in 17s
Test / e2e-test (push) Successful in 50s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { requestJSON, api } from '../composables/useApi'
|
import { api } from '../composables/useApi'
|
||||||
|
|
||||||
export const usePlansStore = defineStore('plans', () => {
|
export const usePlansStore = defineStore('plans', () => {
|
||||||
const plans = ref([])
|
const plans = ref([])
|
||||||
@@ -11,11 +11,13 @@ export const usePlansStore = defineStore('plans', () => {
|
|||||||
const pendingPlans = computed(() => plans.value.filter(p => p.status === 'pending'))
|
const pendingPlans = computed(() => plans.value.filter(p => p.status === 'pending'))
|
||||||
|
|
||||||
async function loadPlans() {
|
async function loadPlans() {
|
||||||
plans.value = await requestJSON('/api/oil-plans')
|
const res = await api('/api/oil-plans')
|
||||||
|
if (res.ok) plans.value = await res.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadTeachers() {
|
async function loadTeachers() {
|
||||||
teachers.value = await requestJSON('/api/teachers')
|
const res = await api('/api/teachers')
|
||||||
|
if (res.ok) teachers.value = await res.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createPlan(healthDesc, teacherId) {
|
async function createPlan(healthDesc, teacherId) {
|
||||||
@@ -50,7 +52,8 @@ export const usePlansStore = defineStore('plans', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadShoppingList(planId) {
|
async function loadShoppingList(planId) {
|
||||||
shoppingList.value = await requestJSON(`/api/oil-plans/${planId}/shopping-list`)
|
const res = await api(`/api/oil-plans/${planId}/shopping-list`)
|
||||||
|
if (res.ok) shoppingList.value = await res.json()
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user