-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28ec78c
commit 0c103bc
Showing
9 changed files
with
113 additions
and
88 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import { ApiService } from './config/ApiService'; | ||
import axiosInstance from './config/axios.config'; | ||
import { Token } from './TokenService'; | ||
const api = new ApiService(); | ||
|
||
export class UserService { | ||
#url = '/user'; | ||
|
||
constructor() { | ||
this.api = new ApiService(); | ||
} | ||
constructor() {} | ||
|
||
async get(token = null) { | ||
return await this.api.get(this.#url, { | ||
Authorization: `Bearer ${token ?? Token.get() ?? ''}`, | ||
}); | ||
return await api.get('/user', token); | ||
} | ||
} | ||
|
||
export const getUser = async (token = null) => { | ||
return axiosInstance.get('/user', { | ||
headers: { | ||
Authorization: `Bearer ${token ?? Token.get()}`, | ||
}, | ||
withCredentials: true, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters