Fix bugs of original data
Return user_id on /auth/login and create database if it wasn't created
This commit is contained in:
parent
a6d6b9f4f2
commit
d3e7ab1aa1
|
@ -33,4 +33,6 @@ def create_app(script_info=None):
|
|||
def ctx():
|
||||
return {"app": app, "db": db}
|
||||
|
||||
return app
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
return app
|
||||
|
|
|
@ -54,7 +54,7 @@ class Login(Resource):
|
|||
access_token = user.encode_token(user.id, "access")
|
||||
refresh_token = user.encode_token(user.id, "refresh")
|
||||
|
||||
response_object = {"access_token": access_token, "refresh_token": refresh_token}
|
||||
response_object = {"access_token": access_token, "refresh_token": refresh_token, "user_id": user.id}
|
||||
return response_object, 200
|
||||
|
||||
|
||||
|
|
|
@ -111,5 +111,8 @@ class User(db.Model):
|
|||
return namespace.clone(
|
||||
"Access and Refresh Token",
|
||||
cls.get_api_auth_refresh_model(namespace),
|
||||
{"access_token": fields.String(required=True)},
|
||||
{
|
||||
"access_token": fields.String(required=True),
|
||||
"user_id": fields.Integer(readOnly=True),
|
||||
},
|
||||
)
|
||||
|
|
|
@ -2,7 +2,6 @@ import { Axios, AxiosError } from "axios";
|
|||
import { Credentials, Token, User, Zone } from "./Types";
|
||||
|
||||
const instance = new Axios({
|
||||
// baseURL: "http://api:5000/",
|
||||
baseURL: "/api/",
|
||||
headers: {
|
||||
accept: "application/json",
|
||||
|
|
Loading…
Reference in New Issue