You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.2 KiB

1 month ago
import apiService from './apiClient';
4 weeks ago
import {CountryList} from '../../constants/countries'
1 month ago
export interface Country {
4 weeks ago
country: number;
currency: string;
language: string;
name: number;
name_en:string
phoneCode: string;
timezone:string,
user_count:number
1 month ago
}
export interface FirstLogin {
currency: string,
language: string,
country: number,
theme: string,
timezone: string,
notifications_enabled: number,
email_notifications: number,
sms_notifications: number,
setting_id: number,
user_id: number,
create_time: string,
update_time: string
}
export interface MySetting {
currency: string,
language: string,
country: number,
theme: string,
timezone: string,
notifications_enabled: number,
email_notifications: number,
sms_notifications: number,
setting_id: number,
user_id: number,
create_time: string,
update_time: string
}
3 weeks ago
export interface ShippingFee {
weight_kg: number | null;
volume_m3: number | null;
country_code: number;
}
1 month ago
3 weeks ago
export interface ShippingFeeResponse {
currency: string;
estimated_shipping_fee_air: number;
estimated_shipping_fee_sea: number;
message: string;
}
1 month ago
export const settingApi = {
4 weeks ago
// 获取国家
getCountryList: () => apiService.get<CountryList[]>('/api/user_settings/countries/'),
// 获取货币
4 weeks ago
getCurrencyList: () => apiService.get<string[]>('/api/user_settings/currencies/'),
4 weeks ago
// 获取语言
4 weeks ago
getLanguageList: () => apiService.get<string[]>('/api/user_settings/languages/'),
4 weeks ago
// 我的设置
4 weeks ago
getMySetting: () => apiService.get<MySetting>('/api/user_settings/me/'),
4 weeks ago
// 首次登录
4 weeks ago
postFirstLogin: (country: number) => apiService.post<FirstLogin>(`/api/user_settings/first_login/?country=${country}`),
4 weeks ago
// 修改设置
4 weeks ago
putSetting: (setting: object) => apiService.put<MySetting>('/api/user_settings/me/', setting),
4 weeks ago
// 获取发送短信的国家列表
getSendSmsCountryList: () => apiService.get<CountryList[]>('/api/user_settings/phone_config/'),
3 weeks ago
// 获取运费信息
getShippingFee: (data: ShippingFee) => apiService.post<ShippingFeeResponse>('/api/orders/calculate_manual_shipping_fee/', data),
1 month ago
}