Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Feature/api integration #10

Open
wants to merge 5 commits into
base: feature/auth
Choose a base branch
from

Conversation

AmrAymanMohamed
Copy link

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

Amr Ayman added 2 commits April 9, 2021 03:03
…he registeration form, fix: changed locals with no nesting, local the rules for registeration
payload = {
...payload,
client_id: '2',
client_secret: 'VqCDubRXgCjgSLvlwUdUMcJ8YYimoubzcKz7VX1L',
Copy link
Contributor

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',
Copy link
Contributor

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.

return await axios.get(url)
}

export { post, get }
Copy link
Contributor

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.

Amr Ayman added 2 commits April 9, 2021 19:29
@@ -0,0 +1,11 @@
const axios = require('axios')
axios.defaults.baseURL = 'http://localhost/api/v1'
Copy link
Contributor

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants