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.

61 lines
1.8 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
}
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/'),
1 month ago
}