Skip to content

Commit 618ce7b

Browse files
author
Gareth Redfern
authored
Merge pull request #13 from garethredfern/feature/auth-service-refactor
Remove async await & return a Promise
2 parents 2a11a36 + d25ceb5 commit 618ce7b

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/services/AuthService.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ export default {
3131
await authClient.get("/sanctum/csrf-cookie");
3232
await authClient.post("/login", payload);
3333
},
34-
async logout() {
35-
await authClient.post("/logout");
34+
logout() {
35+
return authClient.post("/logout");
3636
},
3737
async forgotPassword(payload) {
3838
await authClient.get("/sanctum/csrf-cookie");
3939
await authClient.post("/forgot-password", payload);
4040
},
41-
async getAuthUser() {
42-
return await authClient.get("/api/users/auth");
41+
getAuthUser() {
42+
return authClient.get("/api/users/auth");
4343
},
4444
async resetPassword(payload) {
4545
await authClient.get("/sanctum/csrf-cookie");
4646
await authClient.post("/reset-password", payload);
4747
},
48-
async updatePassword(payload) {
49-
await authClient.put("/user/password", payload);
48+
updatePassword(payload) {
49+
return authClient.put("/user/password", payload);
5050
},
5151
async registerUser(payload) {
5252
await authClient.get("/sanctum/csrf-cookie");
5353
await authClient.post("/register", payload);
5454
},
55-
async sendVerification(payload) {
56-
await authClient.post("/email/verification-notification", payload);
55+
sendVerification(payload) {
56+
return authClient.post("/email/verification-notification", payload);
5757
},
58-
async updateUser(payload) {
59-
await authClient.put("/user/profile-information", payload);
58+
updateUser(payload) {
59+
return authClient.put("/user/profile-information", payload);
6060
},
6161
};

src/services/FileService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as API from "@/services/API";
22

33
export default {
4-
async uploadFile(payload) {
5-
await API.apiClient.post(payload.endpoint, payload.file);
4+
uploadFile(payload) {
5+
return API.apiClient.post(payload.endpoint, payload.file);
66
},
77
};

0 commit comments

Comments
 (0)