Skip to content

Commit b005dd0

Browse files
committed
remove redundant variables from profile service
1 parent 0590de4 commit b005dd0

File tree

1 file changed

+10
-45
lines changed

1 file changed

+10
-45
lines changed

src/app/mydata/services/profile.service.ts

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -104,36 +104,22 @@ export class ProfileService {
104104

105105
async checkProfileExists() {
106106
await this.updateToken();
107-
let checkResult = await firstValueFrom(this.http.get(this.apiUrl + '/userprofile/', this.httpOptions));
108-
return checkResult;
107+
return firstValueFrom(this.http.get(this.apiUrl + '/userprofile/', this.httpOptions));
109108
}
110109

111110
async createProfile() {
112111
await this.updateToken();
113-
let createResponse = await firstValueFrom(
114-
this.http.post(
115-
this.apiUrl + '/userprofile/',
116-
null,
117-
this.httpOptions
118-
));
119-
return createResponse;
112+
return firstValueFrom(this.http.post(this.apiUrl + '/userprofile/', null, this.httpOptions));
120113
}
121114

122115
async deleteProfile() {
123116
await this.updateToken();
124-
let deleteResponse = await firstValueFrom(
125-
this.http.delete(this.apiUrl + '/userprofile/', this.httpOptions)
126-
);
127-
return deleteResponse;
117+
return firstValueFrom(this.http.delete(this.apiUrl + '/userprofile/', this.httpOptions));
128118
}
129119

130120
async hideProfile() {
131121
await this.updateToken();
132-
let hideResponse = await firstValueFrom(this.http.get(
133-
this.apiUrl + '/settings/hideprofile',
134-
this.httpOptions
135-
));
136-
return hideResponse;
122+
return firstValueFrom(this.http.get(this.apiUrl + '/settings/hideprofile', this.httpOptions));
137123
}
138124

139125
/*
@@ -142,14 +128,12 @@ export class ProfileService {
142128
*/
143129
async deleteAccount() {
144130
await this.updateToken({ bypassOrcidCheck: true });
145-
let deleteResponse = await firstValueFrom(this.http.delete(this.apiUrl + '/accountdelete/', this.httpOptions));
146-
return deleteResponse;
131+
return firstValueFrom(this.http.delete(this.apiUrl + '/accountdelete/', this.httpOptions));
147132
}
148133

149134
async getOrcidData() {
150135
await this.updateToken();
151-
let orcidData = await firstValueFrom(this.http.get(this.apiUrl + '/orcid/', this.httpOptions));
152-
return orcidData;
136+
return firstValueFrom(this.http.get(this.apiUrl + '/orcid/', this.httpOptions));
153137
}
154138

155139
async getProfileData(): Promise<any> {
@@ -171,37 +155,19 @@ export class ProfileService {
171155
async patchObjects(items) {
172156
await this.updateToken();
173157
let body = { groups: [], items: items };
174-
175-
let patchResponse = await firstValueFrom(this.http.patch(
176-
this.apiUrl + '/profiledata/',
177-
body,
178-
this.httpOptions
179-
));
180-
return patchResponse;
158+
return firstValueFrom(this.http.patch(this.apiUrl + '/profiledata/', body, this.httpOptions));
181159
}
182160

183161
async patchProfileDataSingleGroup(group) {
184162
await this.updateToken();
185163
let body = { groups: group, items: [] };
186-
187-
let patchResponse = await firstValueFrom(this.http.patch(
188-
this.apiUrl + '/profiledata/',
189-
body,
190-
this.httpOptions
191-
));
192-
return patchResponse;
164+
return firstValueFrom(this.http.patch(this.apiUrl + '/profiledata/', body, this.httpOptions));
193165
}
194166

195167
async patchProfileDataSingleItem(item) {
196168
await this.updateToken();
197169
let body = { groups: [], items: item };
198-
199-
let patchResponse = await firstValueFrom(this.http.patch(
200-
this.apiUrl + '/profiledata/',
201-
body,
202-
this.httpOptions
203-
));
204-
return patchResponse;
170+
return firstValueFrom(this.http.patch(this.apiUrl + '/profiledata/', body, this.httpOptions));
205171
}
206172

207173
/*
@@ -211,7 +177,6 @@ export class ProfileService {
211177
*/
212178
async accountlink() {
213179
await this.updateToken({ bypassOrcidCheck: true });
214-
let linkingResp = await firstValueFrom(this.http.get(this.apiUrl + '/accountlink/', this.httpOptions));
215-
return linkingResp;
180+
return firstValueFrom(this.http.get(this.apiUrl + '/accountlink/', this.httpOptions));
216181
}
217182
}

0 commit comments

Comments
 (0)