mirror of
https://git.meshkee.com/Meshkee/dashboards.git
synced 2026-08-11 22:30:58 +04:30
Includes business, customer, and super-admin apps with shared packages and production deploy scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import { apiRequest } from '../lib/api'
|
|
|
|
export interface UserAddress {
|
|
id: string
|
|
label: string | null
|
|
province: string
|
|
city: string
|
|
address: string
|
|
postalCode: string | null
|
|
landline: string | null
|
|
createdAt: string
|
|
updatedAt: string
|
|
}
|
|
|
|
export interface UserAddressInput {
|
|
label?: string
|
|
province: string
|
|
city: string
|
|
address: string
|
|
postalCode?: string
|
|
landline?: string
|
|
}
|
|
|
|
export async function listAddresses(signal?: AbortSignal) {
|
|
return apiRequest<{ items: UserAddress[] }>('/auth/addresses', { auth: true, signal })
|
|
}
|
|
|
|
export async function createAddress(input: UserAddressInput) {
|
|
return apiRequest<{ address: UserAddress }>('/auth/addresses', {
|
|
method: 'POST',
|
|
auth: true,
|
|
body: input,
|
|
})
|
|
}
|
|
|
|
export async function updateAddress(addressId: string, input: UserAddressInput) {
|
|
return apiRequest<{ address: UserAddress }>(`/auth/addresses/${addressId}`, {
|
|
method: 'PATCH',
|
|
auth: true,
|
|
body: input,
|
|
})
|
|
}
|
|
|
|
export async function removeAddress(addressId: string) {
|
|
return apiRequest<{ message: string }>(`/auth/addresses/${addressId}`, {
|
|
method: 'DELETE',
|
|
auth: true,
|
|
})
|
|
}
|