-
-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/api integration #10
base: feature/auth
Are you sure you want to change the base?
Conversation
…he registeration form, fix: changed locals with no nesting, local the rules for registeration
…bug in register form submission
payload = { | ||
...payload, | ||
client_id: '2', | ||
client_secret: 'VqCDubRXgCjgSLvlwUdUMcJ8YYimoubzcKz7VX1L', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client ID and secret should be grabbed from the env variables.
payload = { | ||
...payload, | ||
client_id: '2', | ||
client_secret: 'VqCDubRXgCjgSLvlwUdUMcJ8YYimoubzcKz7VX1L', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client ID and secret should be grabbed from the env variables.
src/services/index.js
Outdated
return await axios.get(url) | ||
} | ||
|
||
export { post, get } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why didn't you export an axios instance instead?
I suggest creating an axios instance with the default params/settings, then export it.
…s itself, handeled it in auth services
src/services/index.js
Outdated
@@ -0,0 +1,11 @@ | |||
const axios = require('axios') | |||
axios.defaults.baseURL = 'http://localhost/api/v1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider fetching BASE_URL from the environment variables. also note that localhost should be changed in production.
What?
added services wrapper on axios
and applied the api services to the register and login.
fixed locals
added locals to login and rules
Why?
to be able to communicate with the api
Did you implemented automated tests for this PR?
not yet
Are the tests passing on Github actions?
Your answer...
Are the tests passing on your local machine?
yes
Fun facts:
added services/index that contains a wrapper for post and get functionalities and fixed part of the url.
in the services file in the modules implemented the login and the register functionalities and exported them to the modules and used them to communicate with the api