UserDomain Add

This commit is contained in:
2023-10-09 15:55:58 +09:00
parent e1f2afa942
commit 76457b6667
11 changed files with 697 additions and 16 deletions

View File

@@ -0,0 +1,21 @@
import { api } from 'boot/axios';
export class Auth
{
async login(user:string,pwd:string):Promise<boolean>
{
const params = new URLSearchParams();
params.append('username', user);
params.append('password', pwd);
try{
const result = await api.post(`http://127.0.0.1:8000/api/token`,params);
console.info(result);
localStorage.setItem('Token', result.data.access_token);
return true;
}catch(e)
{
console.info(e);
return false;
}
}
}