Fixed: fixed bug scrcpy and shell is disconnect when switch page
This commit is contained in:
parent
9543d4541c
commit
0fe469b5c6
43 changed files with 1378 additions and 1366 deletions
52
client-electron/src/hooks/recipe-dashboard.ts
Normal file
52
client-electron/src/hooks/recipe-dashboard.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import customAxios from '@/lib/customAxios'
|
||||
import { type RecipeDashboard } from '@/models/recipe/schema'
|
||||
import { create } from 'zustand'
|
||||
|
||||
export interface RecipeDashboardFilterQuery {
|
||||
countryID: string
|
||||
filename: string
|
||||
}
|
||||
|
||||
interface materialDashboard {
|
||||
lebel: string
|
||||
value: string
|
||||
}
|
||||
|
||||
interface RecipeDashboardHook {
|
||||
getRecipesDashboard: (filter?: RecipeDashboardFilterQuery) => Promise<RecipeDashboard[] | []>
|
||||
getMaterials: (filter?: RecipeDashboardFilterQuery) => Promise<materialDashboard[] | []>
|
||||
}
|
||||
|
||||
const useRecipeDashboard = create<RecipeDashboardHook>(() => ({
|
||||
async getRecipesDashboard(filter) {
|
||||
return customAxios
|
||||
.get<RecipeDashboard[]>('/v2/recipes/dashboard', {
|
||||
params: filter
|
||||
? {
|
||||
country_id: filter.countryID,
|
||||
filename: filter.filename
|
||||
}
|
||||
: undefined
|
||||
})
|
||||
.then(res => {
|
||||
return res.data
|
||||
})
|
||||
.catch(() => [])
|
||||
},
|
||||
async getMaterials(filter) {
|
||||
return customAxios
|
||||
.get<materialDashboard[]>('/v2/materials/dashboard', {
|
||||
params: filter
|
||||
? {
|
||||
country_id: filter.countryID,
|
||||
filename: filter.filename
|
||||
}
|
||||
: undefined
|
||||
})
|
||||
.then(res => {
|
||||
return res.data
|
||||
})
|
||||
}
|
||||
}))
|
||||
|
||||
export default useRecipeDashboard
|
||||
Loading…
Add table
Add a link
Reference in a new issue