diff --git a/src/stores/Auth.js b/src/stores/Auth.js index 8b17a0b..ef05fdc 100644 --- a/src/stores/Auth.js +++ b/src/stores/Auth.js @@ -4,8 +4,6 @@ import { HT_HOST } from "@/config" import { loadPageSpy } from '@/pageSpy' import { usingStorage } from '@/hooks/usingStorage' -import { lifecycleware } from '@/utils/lifecycle' - const KEY_LOGIN_TOKEN = 'G-STR:LOGIN_TOKEN' const KEY_TRAVEL_AGENCY_ID = 'G-INT:TRAVEL_AGENCY_ID' const KEY_USER_ID = 'G-INT:USER_ID' @@ -161,20 +159,20 @@ const useAuthStore = create((set, get) => ({ // TODO: 迁移到 Account.js changeUserPassword: (password, newPassword) => { const { userId } = usingStorage() - const formData = new FormData(); - formData.append('UserID', userId); - formData.append('Password', password); - formData.append('NewPassword', newPassword); - const postUrl = HT_HOST + '/service-CooperateSOA/SetPassword'; + const formData = new FormData() + formData.append('UserID', userId) + formData.append('Password', password) + formData.append('NewPassword', newPassword) + const postUrl = HT_HOST + '/service-CooperateSOA/SetPassword' return postForm(postUrl, formData) .then(json => { if (json.errcode == 0) { - return json; + return json } else { - throw new Error(json.errmsg + ': ' + json.errcode); + throw new Error(json.errmsg + ': ' + json.errcode) } - }); + }) }, isPermitted: (perm) => { diff --git a/src/stores/Reservation.js b/src/stores/Reservation.js index d57ac56..2984fe2 100644 --- a/src/stores/Reservation.js +++ b/src/stores/Reservation.js @@ -8,7 +8,7 @@ export const fetchCityList = async (travelAgencyId, reservationId) => { const { errcode, Result } = await fetchJSON( `${HT_HOST}/service-cusservice/PTGetCityGuide`, { VEI_SN: travelAgencyId, GRI_SN: reservationId, LGC: 1 }) - return errcode !== 0 ? {} : Result; + return errcode !== 0 ? {} : Result } export const fetchPlanDetail = async (travelAgencyId, reservationId) => { @@ -31,7 +31,7 @@ export const fetchAttachList = async (reservationId) => { const { errcode, result } = await fetchJSON( `${HT_HOST}/service-fileServer/PlanChangeFileList`, { GRI_SN: reservationId }) - return errcode !== 0 ? {} : result; + return errcode !== 0 ? {} : result } const useReservationStore = create((set, get) => ({ @@ -105,12 +105,12 @@ const useReservationStore = create((set, get) => ({ .append('TotalNum', totalNum) .append('PageSize', reservationPage.size) .append('PageIndex', current) - .build(); + .build() return fetchJSON(fetchUrl) .then(json => { if (json.errcode == 0) { - const mapReservationList = (json?.Result??[]).map((data, index) => { + const mapReservationList = (json?.Result??[]).map((data) => { return { key: data.vas_gri_sn, reservationId: data.vas_gri_sn, @@ -132,32 +132,32 @@ const useReservationStore = create((set, get) => ({ } })) } else { - throw new Error(json.errmsg + ': ' + json.errcode); + throw new Error(json.errmsg + ': ' + json.errcode) } - }); + }) }, fetchAllGuideList: () => { const { travelAgencyId } = usingStorage() const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTGetGuideList') .append('VEI_SN', travelAgencyId) - .build(); + .build() return fetchJSON(fetchUrl) .then(json => { if (json.errcode == 0) { - const guideList = (json?.Result??[]).map((data, index) => { + const guideList = (json?.Result??[]).map((data) => { return { guideId: data.TGI_SN, guideName: data.TGI2_Name, mobileNo: data.TGI_Mobile } - }); - return guideList; + }) + return guideList } else { - throw new Error(json.errmsg + ': ' + json.errcode); + throw new Error(json.errmsg + ': ' + json.errcode) } - }); + }) }, getReservationDetail: async (reservationId) => { @@ -167,8 +167,8 @@ const useReservationStore = create((set, get) => ({ const mapConfirmationList = planChangeList.map((data) => { const filterAttchList = attachListJson.filter(attch => { - return attch.PCI_SN === data.PCI_SN; - }); + return attch.PCI_SN === data.PCI_SN + }) return { key: data.PCI_SN, PCI_Changetext: data.PCI_Changetext, @@ -209,7 +209,7 @@ const useReservationStore = create((set, get) => ({ getReservationDetail(travelAgencyId, reservationDetail.reservationId) return json } - }); + }) }, setupCityGuide: (cityId, guideId) => { @@ -229,7 +229,7 @@ const useReservationStore = create((set, get) => ({ if (json.errcode != 0) { throw new Error(json.errmsg + ': ' + json.errcode) } - }); + }) }, @@ -241,7 +241,7 @@ const useReservationStore = create((set, get) => ({ .append('VEI_SN', travelAgencyId) .append('GRI_SN', selectedReservation.reservationId) .append('LGC', 1) - .build(); + .build() return fetchJSON(fetchUrl) .then(json => { @@ -252,10 +252,6 @@ const useReservationStore = create((set, get) => ({ return data.GuideName }).join(',') - runInAction(() => { - selectedReservation.guide = reservationGuide - }) - set((state) => ({ selectedReservation: { ...state.selectedReservation,