前端APIのURL参数化対応およびバックエンドのBugFix

This commit is contained in:
2023-11-08 15:44:42 +09:00
parent 5951fcc108
commit 0f154832a5
14 changed files with 58 additions and 42 deletions

View File

@@ -28,7 +28,7 @@ export const useAuthStore = defineStore({
params.append('username', username);
params.append('password', password);
try{
const result = await api.post(`http://127.0.0.1:8000/api/token`,params);
const result = await api.post(`api/token`,params);
console.info(result);
this.token =result.data.access_token;
localStorage.setItem('token', result.data.access_token);
@@ -44,7 +44,7 @@ export const useAuthStore = defineStore({
}
},
async getCurrentDomain():Promise<IDomainInfo>{
const activedomain = await api.get(`http://127.0.0.1:8000/api/activedomain`);
const activedomain = await api.get(`api/activedomain`);
return {
id:activedomain.data.id,
domainName:activedomain.data.name,
@@ -52,7 +52,7 @@ export const useAuthStore = defineStore({
}
},
async getUserDomains():Promise<IDomainInfo[]>{
const resp = await api.get(`http://127.0.0.1:8000/api/domain`);
const resp = await api.get(`api/domain`);
const domains =resp.data as any[];
return domains.map(data=>{
return {
@@ -72,7 +72,7 @@ export const useAuthStore = defineStore({
if(domain.id===this.currentDomain.id){
return;
}
await api.put(`http://127.0.0.1:8000/api/activedomain/${domain.id}`);
await api.put(`api/activedomain/${domain.id}`);
this.currentDomain=domain;
localStorage.setItem('currentDomain',JSON.stringify(this.currentDomain));
}