test upload file to server

This commit is contained in:
Kenta420 2024-02-05 11:45:54 +07:00
parent 16e0e4f9d8
commit aaa60216b2
43 changed files with 1814 additions and 285 deletions

View file

@ -0,0 +1,16 @@
import customAxios from '@/lib/customAxios'
import { type RecipeOverview } from '@/models/recipe/schema'
interface GetRecipeOverviewFilterQuery {
countryID: string
filename: string
materialIDs: string
}
export const getRecipeOverview = (query?: GetRecipeOverviewFilterQuery): Promise<RecipeOverview[]> => {
return customAxios
.get<RecipeOverview[]>(import.meta.env.TAOBIN_RECIPE_MANAGER_SERVER_URL + '/recipe/overview', { params: query })
.then(res => {
return res.data
})
}

View file

@ -1,18 +1,11 @@
import { create } from 'zustand'
import customAxios from '../lib/customAxios'
export interface UserInfo {
id: string
name: string
email: string
picture: string
permissions: string[]
}
import type { User } from '@/models/user/schema'
interface UserAuth {
userInfo: UserInfo | null
setUserInfo: (userInfo: UserInfo | null) => void
getUserInfo: () => Promise<UserInfo | null>
userInfo: User | null
setUserInfo: (userInfo: User | null) => void
getUserInfo: () => Promise<User | null>
logout: () => void
}
@ -21,7 +14,7 @@ const userAuthStore = create<UserAuth>(set => ({
setUserInfo: userInfo => set({ userInfo }),
getUserInfo: () => {
return customAxios
.get<UserInfo>('/user/me')
.get<User>('/user/me')
.then(res => {
set({ userInfo: res.data })
return res.data