-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/tas 8 helper methods for authentication #20
Feature/tas 8 helper methods for authentication #20
Conversation
This reverts commit d10f696.
…testing Set up Testing
const BASE_URL = 'https://example.com/auth'; | ||
const LOGIN_URL = `${BASE_URL}/login`; | ||
const LOGOUT_URL = `${BASE_URL}/logout`; |
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.
use resolveURL function from @/src/api/fetch
throw new Error('Failed to sign in'); | ||
} | ||
|
||
return response.json(); |
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.
should return response object and not json
// Clear cookies on the client side | ||
document.cookie.split(';').forEach(cookie => { | ||
document.cookie = cookie.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/'); | ||
}); |
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.
should return response too, in case sign out failed and errors can be handled
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, |
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.
need to set credentials
to include
to save csrf token
Pull Request
Description
Create authentication.ts file with helper methods for user sign in and sign out.
Related Issues
Checklist
Please review and check the following before submitting your pull request:
Screenshots (if applicable)
Desktop
Mobile
Additional Information
Reviewer Notes