Initial commit: Meshkee dashboards monorepo.
Includes business, customer, and super-admin apps with shared packages and production deploy scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { apiRequest } from '../lib/api'
|
||||
import { getActiveBusinessId } from '../lib/businessContext'
|
||||
import type { ProductApi } from './productService'
|
||||
|
||||
export type ProductAiLanguage = 'en' | 'fa'
|
||||
|
||||
export interface CreateProductByAiPayload {
|
||||
categoryId: string
|
||||
name: string
|
||||
language: ProductAiLanguage
|
||||
}
|
||||
|
||||
export async function createProductByAi(payload: CreateProductByAiPayload) {
|
||||
const businessId = getActiveBusinessId()
|
||||
if (!businessId) {
|
||||
throw new Error('No active business selected. Please sign in again.')
|
||||
}
|
||||
|
||||
return apiRequest<{ message: string; product: ProductApi }>(
|
||||
`/businesses/${businessId}/products/ai-create`,
|
||||
{
|
||||
method: 'POST',
|
||||
auth: true,
|
||||
body: payload,
|
||||
},
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user