Move auth to a dedicated route

This commit is contained in:
nemunaire 2020-05-22 15:49:56 +02:00
commit 725ce10eb5
2 changed files with 6 additions and 6 deletions

View file

@ -50,11 +50,11 @@ import (
var AuthFunc = checkAuth
func init() {
router.GET("/api/users/auth", apiAuthHandler(displayAuthToken))
router.POST("/api/users/auth", apiHandler(func(opts *config.Options, ps httprouter.Params, b io.Reader) Response {
router.GET("/api/auth", apiAuthHandler(displayAuthToken))
router.POST("/api/auth", apiHandler(func(opts *config.Options, ps httprouter.Params, b io.Reader) Response {
return AuthFunc(opts, ps, b)
}))
router.POST("/api/users/auth/logout", apiHandler(logout))
router.POST("/api/auth/logout", apiHandler(logout))
}
type DisplayUser struct {

View file

@ -116,7 +116,7 @@ export default {
methods: {
logout () {
axios
.post('/api/users/auth/logout')
.post('/api/auth/logout')
.then(
(response) => {
delete sessionStorage.loggedUser
@ -137,7 +137,7 @@ export default {
},
updateSession () {
axios.get('/api/users/auth')
axios.get('/api/auth')
.then(
(response) => {
sessionStorage.loggedUser = JSON.stringify(response.data)
@ -163,7 +163,7 @@ export default {
login (email, password) {
axios
.post('/api/users/auth', {
.post('/api/auth', {
email: email,
password: password
})