前端APIのURL参数化対応およびバックエンドのBugFix
This commit is contained in:
@@ -8,7 +8,7 @@ import deepdiff
|
|||||||
import app.core.config as config
|
import app.core.config as config
|
||||||
import os
|
import os
|
||||||
from app.db.session import SessionLocal
|
from app.db.session import SessionLocal
|
||||||
from app.db.crud import get_flows,get_activedomain
|
from app.db.crud import get_flows_by_app,get_activedomain
|
||||||
from app.core.auth import get_current_active_user,get_current_user
|
from app.core.auth import get_current_active_user,get_current_user
|
||||||
|
|
||||||
kinton_router = r = APIRouter()
|
kinton_router = r = APIRouter()
|
||||||
@@ -258,19 +258,17 @@ def updateappjscss(app,uploads,c:config.KINTONE_ENV):
|
|||||||
|
|
||||||
def createappjs(app):
|
def createappjs(app):
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
flows = get_flows(db,app)
|
flows = get_flows_by_app(db,app)
|
||||||
db.close()
|
db.close()
|
||||||
content={}
|
content={}
|
||||||
for flow in flows:
|
for flow in flows:
|
||||||
content[flow.eventid] = {'flowid':flow.flowid,'name':flow.name,'content':flow.content}
|
content[flow.eventid] = {'flowid':flow.flowid,'name':flow.name,'content':flow.content}
|
||||||
js = 'const flow=' + json.dumps(content)
|
js = 'const alcflow=' + json.dumps(content)
|
||||||
fpath = '{}\\alc_setting_{}.js'.format('Temp',app)
|
fpath = os.path.join("Temp",f"alc_setting_{app}.js")
|
||||||
file = open(fpath,'w',encoding="utf-8")
|
with open(fpath,'w') as file:
|
||||||
file.write(js)
|
file.write(js)
|
||||||
file.close()
|
|
||||||
return fpath
|
return fpath
|
||||||
|
|
||||||
|
|
||||||
@r.post("/test",)
|
@r.post("/test",)
|
||||||
async def test(file:UploadFile= File(...),app:str=None):
|
async def test(file:UploadFile= File(...),app:str=None):
|
||||||
if file.filename.endswith('.xlsx'):
|
if file.filename.endswith('.xlsx'):
|
||||||
@@ -340,7 +338,14 @@ async def jscss(app:str,files:t.List[UploadFile] = File(...),env = Depends(getki
|
|||||||
return appjscs
|
return appjscs
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=400, detail=f"Error occurred while update file {file.filename}: {str(e)}")
|
raise HTTPException(status_code=400, detail=f"Error occurred while update file {file.filename}: {str(e)}")
|
||||||
|
|
||||||
|
@r.get("/app")
|
||||||
|
async def app(app:str,c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
||||||
|
headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE}
|
||||||
|
url = f"{c.BASE_URL}{config.API_V1_STR}/app.json"
|
||||||
|
params ={"id":app}
|
||||||
|
r = httpx.get(url,headers=headers,params=params)
|
||||||
|
return r.json()
|
||||||
|
|
||||||
@r.get("/allapps")
|
@r.get("/allapps")
|
||||||
async def allapps(c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
async def allapps(c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
||||||
@@ -401,7 +406,7 @@ async def createappfromexcel(files:t.List[UploadFile] = File(...),env = Depends(
|
|||||||
app = updateappsettingstokintone(result["app"],{"description":desc},env)
|
app = updateappsettingstokintone(result["app"],{"description":desc},env)
|
||||||
if app.get("revision") != None:
|
if app.get("revision") != None:
|
||||||
result["revision"] = app["revision"]
|
result["revision"] = app["revision"]
|
||||||
app = addfieldstokintone(result["app"],env,fields)
|
app = addfieldstokintone(result["app"],fields,env)
|
||||||
if len(processes)> 0:
|
if len(processes)> 0:
|
||||||
app = updateprocesstokintone(result["app"],processes,env)
|
app = updateprocesstokintone(result["app"],processes,env)
|
||||||
if app.get("revision") != None:
|
if app.get("revision") != None:
|
||||||
@@ -410,8 +415,7 @@ async def createappfromexcel(files:t.List[UploadFile] = File(...),env = Depends(
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=400, detail=f"Error occurred while parsing file {file.filename}: {str(e)}")
|
raise HTTPException(status_code=400, detail=f"Error occurred while parsing file {file.filename}: {str(e)}")
|
||||||
else:
|
else:
|
||||||
raise HTTPException(status_code=400, detail=f"File {file.filename} is not an Excel file")
|
raise HTTPException(status_code=400, detail=f"File {file.filename} is not an Excel file")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
KAB_BACKEND_URL="http://127.0.0.1:8000/api/v1/"
|
KAB_BACKEND_URL="http://127.0.0.1:8000/"
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default {
|
|||||||
]
|
]
|
||||||
const rows = reactive([])
|
const rows = reactive([])
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await api.get('http://127.0.0.1:8000/api/kintone/1').then(res =>{
|
await api.get('api/kintone/1').then(res =>{
|
||||||
res.data.forEach((item) =>
|
res.data.forEach((item) =>
|
||||||
{
|
{
|
||||||
rows.push({name:item.name,desc:item.desc,content:item.content});
|
rows.push({name:item.name,desc:item.desc,content:item.content});
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
import { AppInfo, AppSeed } from './models';
|
import { AppInfo, AppSeed } from './models';
|
||||||
import { ref, defineComponent, watch, onMounted , toRefs } from 'vue';
|
import { ref, defineComponent, watch, onMounted , toRefs } from 'vue';
|
||||||
import { api } from 'boot/axios';
|
import { api } from 'boot/axios';
|
||||||
import { promises } from 'dns';
|
import { useAuthStore } from 'src/stores/useAuthStore';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
@@ -44,12 +44,13 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const { app } = toRefs(props);
|
const { app } = toRefs(props);
|
||||||
|
const authStore = useAuthStore();
|
||||||
const appinfo = ref<AppInfo>({
|
const appinfo = ref<AppInfo>({
|
||||||
appId: "",
|
appId: "",
|
||||||
name: "",
|
name: "",
|
||||||
description: ""
|
description: ""
|
||||||
});
|
});
|
||||||
const link= ref('https://mfu07rkgnb7c.cybozu.com/k/' + app.value);
|
const link= ref(`${authStore.currentDomain.kintoneUrl}/k/${app.value}`);
|
||||||
const getAppInfo = async (appId:string|undefined) => {
|
const getAppInfo = async (appId:string|undefined) => {
|
||||||
if(!appId){
|
if(!appId){
|
||||||
return;
|
return;
|
||||||
@@ -59,7 +60,7 @@ export default defineComponent({
|
|||||||
let retry =0;
|
let retry =0;
|
||||||
while(retry<=3 && result && result.appId!==appId){
|
while(retry<=3 && result && result.appId!==appId){
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||||
const response = await api.get('app', {
|
const response = await api.get('api/v1/app', {
|
||||||
params:{
|
params:{
|
||||||
app: appId
|
app: appId
|
||||||
}
|
}
|
||||||
@@ -73,7 +74,7 @@ export default defineComponent({
|
|||||||
|
|
||||||
watch(app, async (newApp) => {
|
watch(app, async (newApp) => {
|
||||||
appinfo.value = await getAppInfo(newApp);
|
appinfo.value = await getAppInfo(newApp);
|
||||||
link.value = 'https://mfu07rkgnb7c.cybozu.com/k/' + newApp;
|
link.value = `${authStore.currentDomain.kintoneUrl}/k/${newApp}`;
|
||||||
}, { immediate: true });
|
}, { immediate: true });
|
||||||
|
|
||||||
const linkClick=(ev : MouseEvent)=>{
|
const linkClick=(ev : MouseEvent)=>{
|
||||||
@@ -82,7 +83,7 @@ export default defineComponent({
|
|||||||
};
|
};
|
||||||
onMounted(async ()=>{
|
onMounted(async ()=>{
|
||||||
appinfo.value = await getAppInfo(app.value);
|
appinfo.value = await getAppInfo(app.value);
|
||||||
link.value = 'https://mfu07rkgnb7c.cybozu.com/k/' + app.value;
|
link.value = `${authStore.currentDomain.kintoneUrl}/k/${app.value}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default {
|
|||||||
]
|
]
|
||||||
const rows = reactive([])
|
const rows = reactive([])
|
||||||
onMounted( () => {
|
onMounted( () => {
|
||||||
api.get('allapps').then(res =>{
|
api.get('api/v1/allapps').then(res =>{
|
||||||
res.data.apps.forEach((item) =>
|
res.data.apps.forEach((item) =>
|
||||||
{
|
{
|
||||||
rows.push({id:item.appId,name:item.name,creator:item.creator.name,createdate:item.createdAt});
|
rows.push({id:item.appId,name:item.name,creator:item.creator.name,createdate:item.createdAt});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
style="max-width: 400px"
|
style="max-width: 400px"
|
||||||
:url="uploadUrl"
|
:url="uploadUrl"
|
||||||
:label="title"
|
:label="title"
|
||||||
|
:headers="headers"
|
||||||
accept=".csv,.xlsx"
|
accept=".csv,.xlsx"
|
||||||
v-on:rejected="onRejected"
|
v-on:rejected="onRejected"
|
||||||
v-on:uploaded="onUploadFinished"
|
v-on:uploaded="onUploadFinished"
|
||||||
@@ -15,7 +16,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { createUploaderComponent, useQuasar } from 'quasar';
|
import { createUploaderComponent, useQuasar } from 'quasar';
|
||||||
|
import { useAuthStore } from 'src/stores/useAuthStore';
|
||||||
|
import { ref } from 'vue';
|
||||||
const $q=useQuasar();
|
const $q=useQuasar();
|
||||||
|
const authStore = useAuthStore();
|
||||||
const emit =defineEmits(['uploaded']);
|
const emit =defineEmits(['uploaded']);
|
||||||
/**
|
/**
|
||||||
* ファイルアップロードを拒否する時の処理
|
* ファイルアップロードを拒否する時の処理
|
||||||
@@ -67,9 +71,12 @@
|
|||||||
title: string;
|
title: string;
|
||||||
uploadUrl:string;
|
uploadUrl:string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const headers = ref([{name:"Authorization",value:'Bearer ' + authStore.token}]);
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
title:"設計書から導入する(csv or excel)",
|
title:"設計書から導入する(csv or excel)",
|
||||||
uploadUrl: `${process.env.KAB_BACKEND_URL}createappfromexcel`
|
uploadUrl: `${process.env.KAB_BACKEND_URL}api/v1/createappfromexcel`
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
]
|
]
|
||||||
const rows = reactive([])
|
const rows = reactive([])
|
||||||
onMounted( () => {
|
onMounted( () => {
|
||||||
api.get(`http://127.0.0.1:8000/api/domains/testtenant`).then(res =>{
|
api.get(`api/domains/testtenant`).then(res =>{
|
||||||
res.data.forEach((item) =>
|
res.data.forEach((item) =>
|
||||||
{
|
{
|
||||||
rows.push({id:item.id,tenantid:item.tenantid,name:item.name,url:item.url,kintoneuser:item.kintoneuser});
|
rows.push({id:item.id,tenantid:item.tenantid,name:item.name,url:item.url,kintoneuser:item.kintoneuser});
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export default {
|
|||||||
]
|
]
|
||||||
const rows = reactive([])
|
const rows = reactive([])
|
||||||
onMounted( () => {
|
onMounted( () => {
|
||||||
api.get('appfields', {
|
api.get('api/v1/appfields', {
|
||||||
params:{
|
params:{
|
||||||
app: props.appId
|
app: props.appId
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
style="font-size: 2em"
|
style="font-size: 2em"
|
||||||
/>
|
/>
|
||||||
<div class="col-7 self-center ellipsis">
|
<div class="col-7 self-center ellipsis">
|
||||||
<a :href="!store.appInfo?'':`https://mfu07rkgnb7c.cybozu.com/k/${store.appInfo?.appId}`" target="_blank" title="Kiontoneへ">
|
<a :href="!store.appInfo?'':`${authStore.currentDomain.kintoneUrl}/k/${store.appInfo?.appId}`" target="_blank" title="Kiontoneへ">
|
||||||
{{ store.appInfo?.name }}
|
{{ store.appInfo?.name }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -33,6 +33,7 @@ import {AppInfo} from '../../types/ActionTypes'
|
|||||||
import ShowDialog from '../../components/ShowDialog.vue';
|
import ShowDialog from '../../components/ShowDialog.vue';
|
||||||
import AppSelect from '../../components/AppSelect.vue';
|
import AppSelect from '../../components/AppSelect.vue';
|
||||||
import { useFlowEditorStore } from 'stores/flowEditor';
|
import { useFlowEditorStore } from 'stores/flowEditor';
|
||||||
|
import { useAuthStore } from 'src/stores/useAuthStore';
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'AppSelector',
|
name: 'AppSelector',
|
||||||
emits:[
|
emits:[
|
||||||
@@ -45,6 +46,7 @@ export default defineComponent({
|
|||||||
setup(props, context) {
|
setup(props, context) {
|
||||||
|
|
||||||
const store = useFlowEditorStore();
|
const store = useFlowEditorStore();
|
||||||
|
const authStore=useAuthStore();
|
||||||
const appDg = ref();
|
const appDg = ref();
|
||||||
const showSelectApp=ref(false);
|
const showSelectApp=ref(false);
|
||||||
|
|
||||||
@@ -67,6 +69,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
store,
|
store,
|
||||||
|
authStore,
|
||||||
showSelectApp,
|
showSelectApp,
|
||||||
showAppDialog,
|
showAppDialog,
|
||||||
closeDg,
|
closeDg,
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ import { api } from 'boot/axios';
|
|||||||
|
|
||||||
export class Auth
|
export class Auth
|
||||||
{
|
{
|
||||||
|
|
||||||
async login(user:string,pwd:string):Promise<boolean>
|
async login(user:string,pwd:string):Promise<boolean>
|
||||||
{
|
{
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
params.append('username', user);
|
params.append('username', user);
|
||||||
params.append('password', pwd);
|
params.append('password', pwd);
|
||||||
try{
|
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);
|
console.info(result);
|
||||||
localStorage.setItem('Token', result.data.access_token);
|
localStorage.setItem('Token', result.data.access_token);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export class FlowCtrl
|
|||||||
{
|
{
|
||||||
const flows:ActionFlow[]=[];
|
const flows:ActionFlow[]=[];
|
||||||
try{
|
try{
|
||||||
const result = await api.get(`http://127.0.0.1:8000/api/flows/${appId}`);
|
const result = await api.get(`api/flows/${appId}`);
|
||||||
//console.info(result.data);
|
//console.info(result.data);
|
||||||
if(!result.data || !Array.isArray(result.data)){
|
if(!result.data || !Array.isArray(result.data)){
|
||||||
return [];
|
return [];
|
||||||
@@ -26,7 +26,7 @@ export class FlowCtrl
|
|||||||
|
|
||||||
async SaveFlow(jsonData:any):Promise<boolean>
|
async SaveFlow(jsonData:any):Promise<boolean>
|
||||||
{
|
{
|
||||||
const result = await api.post('http://127.0.0.1:8000/api/flow',jsonData);
|
const result = await api.post('api/flow',jsonData);
|
||||||
console.info(result.data)
|
console.info(result.data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ export class FlowCtrl
|
|||||||
*/
|
*/
|
||||||
async UpdateFlow(jsonData:any):Promise<boolean>
|
async UpdateFlow(jsonData:any):Promise<boolean>
|
||||||
{
|
{
|
||||||
const result = await api.put('http://127.0.0.1:8000/api/flow/' + jsonData.flowid,jsonData);
|
const result = await api.put('api/flow/' + jsonData.flowid,jsonData);
|
||||||
console.info(result.data)
|
console.info(result.data)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ export class FlowCtrl
|
|||||||
*/
|
*/
|
||||||
async depoly(appid:string):Promise<boolean>
|
async depoly(appid:string):Promise<boolean>
|
||||||
{
|
{
|
||||||
const result = await api.post(`http://127.0.0.1:8000/api/v1/createjstokintone?app=${appid}`);
|
const result = await api.post(`api/v1/createjstokintone?app=${appid}`);
|
||||||
console.info(result.data);
|
console.info(result.data);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ const columns = [
|
|||||||
|
|
||||||
const getDomain = () => {
|
const getDomain = () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
api.get(`http://127.0.0.1:8000/api/domains/testtenant`).then(res => {
|
api.get(`api/domains/testtenant`).then(res => {
|
||||||
rows.length = 0;
|
rows.length = 0;
|
||||||
res.data.forEach((item) => {
|
res.data.forEach((item) => {
|
||||||
rows.push({ id:item.id,tenantid: item.tenantid,name: item.name, url: item.url, user: item.kintoneuser, password: item.kintonepwd });
|
rows.push({ id:item.id,tenantid: item.tenantid,name: item.name, url: item.url, user: item.kintoneuser, password: item.kintonepwd });
|
||||||
@@ -153,7 +153,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const deleteDomain = () => {
|
const deleteDomain = () => {
|
||||||
api.delete(`http://127.0.0.1:8000/api/domain/`+ editId.value).then(() =>{
|
api.delete(`api/domain/${editId.value}`).then(() =>{
|
||||||
getDomain();
|
getDomain();
|
||||||
})
|
})
|
||||||
editId.value = 0;
|
editId.value = 0;
|
||||||
@@ -183,7 +183,7 @@ onMounted(() => {
|
|||||||
const onSubmit = () => {
|
const onSubmit = () => {
|
||||||
if(editId.value !== 0)
|
if(editId.value !== 0)
|
||||||
{
|
{
|
||||||
api.put(`http://127.0.0.1:8000/api/domain`,{
|
api.put(`api/domain`,{
|
||||||
'id': editId.value,
|
'id': editId.value,
|
||||||
'tenantid': tenantid.value,
|
'tenantid': tenantid.value,
|
||||||
'name': name.value,
|
'name': name.value,
|
||||||
@@ -198,7 +198,7 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
api.post(`http://127.0.0.1:8000/api/domain`,{
|
api.post(`api/domain`,{
|
||||||
'id': 0,
|
'id': 0,
|
||||||
'tenantid': tenantid.value,
|
'tenantid': tenantid.value,
|
||||||
'name': name.value,
|
'name': name.value,
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ const newDomain = () => {
|
|||||||
|
|
||||||
|
|
||||||
const activeDomain = (id:number) => {
|
const activeDomain = (id:number) => {
|
||||||
api.put(`http://127.0.0.1:8000/api/activedomain/`+ id).then(() =>{
|
api.put(`api/activedomain/`+ id).then(() =>{
|
||||||
getDomain();
|
getDomain();
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
@@ -234,7 +234,7 @@ const deleteConfirm = (row:object) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const deleteDomain = () => {
|
const deleteDomain = () => {
|
||||||
api.delete(`http://127.0.0.1:8000/api/domain/`+ editId.value+'/1').then(() =>{
|
api.delete(`api/domain/`+ editId.value+'/1').then(() =>{
|
||||||
getDomain();
|
getDomain();
|
||||||
})
|
})
|
||||||
editId.value = 0;
|
editId.value = 0;
|
||||||
@@ -248,16 +248,16 @@ const closeDg = (val:string) => {
|
|||||||
{
|
{
|
||||||
dodmainids.push(domains[key].id);
|
dodmainids.push(domains[key].id);
|
||||||
}
|
}
|
||||||
api.post(`http://127.0.0.1:8000/api/domain`, dodmainids).then(() =>{getDomain();});
|
api.post(`api/domain`, dodmainids).then(() =>{getDomain();});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
const getDomain = () => {
|
const getDomain = () => {
|
||||||
api.get(`http://127.0.0.1:8000/api/activedomain`).then(res => {
|
api.get(`api/activedomain`).then(res => {
|
||||||
activedomainid.value = res.data.id;
|
activedomainid.value = res.data.id;
|
||||||
authStore.changedomain(res.data.name);
|
authStore.changedomain(res.data.name);
|
||||||
});
|
});
|
||||||
api.get(`http://127.0.0.1:8000/api/domain`).then(res => {
|
api.get(`api/domain`).then(res => {
|
||||||
rows.length = 0;
|
rows.length = 0;
|
||||||
res.data.forEach((item) => {
|
res.data.forEach((item) => {
|
||||||
rows.push({ id:item.id,name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd});
|
rows.push({ id:item.id,name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd});
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export const useAuthStore = defineStore({
|
|||||||
params.append('username', username);
|
params.append('username', username);
|
||||||
params.append('password', password);
|
params.append('password', password);
|
||||||
try{
|
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);
|
console.info(result);
|
||||||
this.token =result.data.access_token;
|
this.token =result.data.access_token;
|
||||||
localStorage.setItem('token', result.data.access_token);
|
localStorage.setItem('token', result.data.access_token);
|
||||||
@@ -44,7 +44,7 @@ export const useAuthStore = defineStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getCurrentDomain():Promise<IDomainInfo>{
|
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 {
|
return {
|
||||||
id:activedomain.data.id,
|
id:activedomain.data.id,
|
||||||
domainName:activedomain.data.name,
|
domainName:activedomain.data.name,
|
||||||
@@ -52,7 +52,7 @@ export const useAuthStore = defineStore({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async getUserDomains():Promise<IDomainInfo[]>{
|
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[];
|
const domains =resp.data as any[];
|
||||||
return domains.map(data=>{
|
return domains.map(data=>{
|
||||||
return {
|
return {
|
||||||
@@ -72,7 +72,7 @@ export const useAuthStore = defineStore({
|
|||||||
if(domain.id===this.currentDomain.id){
|
if(domain.id===this.currentDomain.id){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await api.put(`http://127.0.0.1:8000/api/activedomain/${domain.id}`);
|
await api.put(`api/activedomain/${domain.id}`);
|
||||||
this.currentDomain=domain;
|
this.currentDomain=domain;
|
||||||
localStorage.setItem('currentDomain',JSON.stringify(this.currentDomain));
|
localStorage.setItem('currentDomain',JSON.stringify(this.currentDomain));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user