|
@@ -3,48 +3,17 @@ import { Profile } from '/@/components/shopSelector/types'
|
|
|
import { request } from '../utils/service'
|
|
|
import { ref, Ref } from 'vue'
|
|
|
|
|
|
-// export const useShopInfo = defineStore('shopInfo', {
|
|
|
-// state: (): Profile => ({
|
|
|
-// id: 0,
|
|
|
-// profileId: '',
|
|
|
-// name: '',
|
|
|
-// timezone: 'America/Los_Angeles',
|
|
|
-// advertiserId: '',
|
|
|
-// countryCode: '',
|
|
|
-// currencyCode: '',
|
|
|
-// marketplaceId: ''
|
|
|
-// }),
|
|
|
-// actions: {
|
|
|
-// async updateShopInfo(id: number) {
|
|
|
-// const resp = await this.getShopInfo(id)
|
|
|
-// this.id = id
|
|
|
-// this.profileId = resp.data.profile_id
|
|
|
-// this.name = resp.data.account_name
|
|
|
-// this.timezone = resp.data.time_zone
|
|
|
-// this.advertiserId = resp.data.advertiser_id
|
|
|
-// this.countryCode = resp.data.country_code
|
|
|
-// this.currencyCode = resp.data.currency_code
|
|
|
-// this.marketplaceId = resp.data.marketplace_str_id
|
|
|
-// },
|
|
|
-// async getShopInfo(id: number) {
|
|
|
-// return request({
|
|
|
-// url: '/api/adManage/profiles/' + id + '/',
|
|
|
-// method: 'GET'
|
|
|
-// })
|
|
|
-// }
|
|
|
-// }
|
|
|
-// })
|
|
|
|
|
|
-export const userShopInfo = defineStore('shopInfo', () => {
|
|
|
+export const useShopInfo = defineStore('shopInfo', () => {
|
|
|
let profile: Ref<Profile> = ref({
|
|
|
id: 0,
|
|
|
- profileId: '',
|
|
|
- name: '',
|
|
|
- timezone: 'America/Los_Angeles',
|
|
|
- advertiserId: '',
|
|
|
- countryCode: '',
|
|
|
- currencyCode: '',
|
|
|
- marketplaceId: ''
|
|
|
+ profile_id: "",
|
|
|
+ account_name: "",
|
|
|
+ time_zone: "",
|
|
|
+ advertiser_id: "",
|
|
|
+ country_code: "",
|
|
|
+ currency_code: "",
|
|
|
+ marketplace_str_id: ""
|
|
|
})
|
|
|
|
|
|
async function getShopInfo(id: number) {
|
|
@@ -54,9 +23,15 @@ export const userShopInfo = defineStore('shopInfo', () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- async function updateShopInfo(id: number) {
|
|
|
- const resp = await getShopInfo(id)
|
|
|
- profile.value = resp.data
|
|
|
+ function updateShopInfo(obj: Profile) {
|
|
|
+ profile.value.id = obj.id
|
|
|
+ profile.value.profile_id = obj.profile_id
|
|
|
+ profile.value.account_name = obj.account_name
|
|
|
+ profile.value.time_zone = obj.time_zone
|
|
|
+ profile.value.advertiser_id = obj.advertiser_id
|
|
|
+ profile.value.country_code = obj.country_code
|
|
|
+ profile.value.currency_code = obj.currency_code
|
|
|
+ profile.value.marketplace_str_id = obj.marketplace_str_id
|
|
|
}
|
|
|
|
|
|
return { profile, updateShopInfo }
|