我需要有关角度8的Apollo本地状态管理的帮助。 问题是我的应用程序运行时,我通过查询我想用从服务器获得的响应来初始化我的状态,从而从我的Apollo服务器获得了响应。 我如何设置和初始化我的状态?
我在我的app.component.ts中创建了这样的阿波罗
this.apollo.create({
link: this.httpLink.create({uri: serviceParam.serviceEndpoint}),
cache: new InMemoryCache(),
});
我从查询中得到的答复是
data:
getApplication:
appID: 185999
creationDate: "21/11/2019"
broker:
brokerEmail: ""
brokerName: "Test, Test"
brokerPhoneNo: ""
__typename: "Broker"
__proto__: Object
customer: Array(1)
0:
custID: 201857
customerCode: "P"
personalInformation: {firstName: "ABC", gender: "", middleName: "", surName: "DEF", title: "Mr", …}
contactInformation: {email: "123@gmail.com", fax: "", homePhoneNo: "", mobileNo: "123456789", preferredContact: "", …}
otherInformation: {bankruptcyDate: null, bankruptcyStatus: "", dateOfBirth: "12/12/1994", dependent: null, foreignCitizen: null, …}
residentialDetail: {accountNum: "", addressDetail: {…}, balanceOwing: "0", homeValue: 0, mobileNo: "", …}
customerAddresses: (2) [{…}, {…}]
customerEmployment: [{…}]
income: []
asset: (10) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
expense: (3) [{…}, {…}, {…}]
liabilities: {liabilitiesID: 202670, carLoan: Array(2), personalLoan: Array(2), investmentProperty: Array(0), other: Array(1), …}
__typename: "Customer"
__proto__: Object
length: 1
__proto__: Array(0)
__typename: "Application"
我希望将此响应设置为我的初始化状态。