保誠-保戶業務員媒合平台
Tomas
2023-08-05 8ca4e8557c729e0a1bc0e2dc9e0d033930539e56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { http } from "./httpClient";
 
import { AgentInfoSetting, UserSetting } from "~/shared/models/account.model";
 
class AccountSettingService{
 
  //取得使用者帳號資訊
  async getUserAccountSetting() : Promise<UserSetting> {
    return http.get<UserSetting>('/customer/info').then(res => res.data);
  }
  //更新使用者帳號資訊
  async updateAccountSetting(params: any) : Promise<any> {
    return http.put('/customer/info', params ).then(res => res.data);
  }
 
  //編輯顧問帳號資訊
  async editAgentInfoSetting(params: any): Promise<AgentInfoSetting> {
    try {
      const response = await http.post('/consultant/edit', params);
      if (response !== null) {
        return response.data;
      } else {
        throw new Error('http.post returned null-like value.');
      }
    } catch (error) {
      console.error('An error occurred while editing agent info setting:', error);
      // 可以在此處處理錯誤或回傳預設值
      throw error;
    }
  }
 
 
}
export default new AccountSettingService();