fix api call result
This commit is contained in:
@@ -23,8 +23,8 @@ export default {
|
|||||||
]
|
]
|
||||||
const rows = reactive([])
|
const rows = reactive([])
|
||||||
onMounted( () => {
|
onMounted( () => {
|
||||||
api.get(`api/domains/1`).then(res =>{
|
api.get(`api/domains`).then(res =>{
|
||||||
res.data.forEach((item) =>
|
res.data.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});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,13 +102,13 @@ const domainLinks: EssentialLinkProps[] = [
|
|||||||
link: '/#/domain',
|
link: '/#/domain',
|
||||||
target: '_self'
|
target: '_self'
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: 'ドメイン適用',
|
title: 'ドメイン適用',
|
||||||
// caption: 'ユーザー使用可能なドメインの設定',
|
caption: 'ユーザー使用可能なドメインの設定',
|
||||||
// icon: 'assignment_ind',
|
icon: 'assignment_ind',
|
||||||
// link: '/#/userDomain',
|
link: '/#/userDomain',
|
||||||
// target: '_self'
|
target: '_self'
|
||||||
// },
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const adminLinks: EssentialLinkProps[] = [
|
const adminLinks: EssentialLinkProps[] = [
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ let ownerid = ref('');
|
|||||||
const getDomain = async () => {
|
const getDomain = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const userId = authStore.userId;
|
const userId = authStore.userId;
|
||||||
const result = await api.get<IDomain[]>(`api/domain?userId=${userId}`);
|
const result = await api.get<IDomain[]>(`api/domains`);
|
||||||
rows.value = result.data.map((item) => {
|
rows.value = result.data.data.map((item) => {
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
tenantid: item.tenantid,
|
tenantid: item.tenantid,
|
||||||
@@ -216,8 +216,7 @@ const deleteDomain = () => {
|
|||||||
api.delete(`api/domain/${editId.value}`).then(() => {
|
api.delete(`api/domain/${editId.value}`).then(() => {
|
||||||
getDomain();
|
getDomain();
|
||||||
})
|
})
|
||||||
editId.value = 0;
|
editId.value = 0; // set in removeRow()
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const editRow = (row) => {
|
const editRow = (row) => {
|
||||||
@@ -259,6 +258,7 @@ const onSubmit = () => {
|
|||||||
'is_active': domainActive.value,
|
'is_active': domainActive.value,
|
||||||
'ownerid': authStore.userId || ''
|
'ownerid': authStore.userId || ''
|
||||||
}
|
}
|
||||||
|
// for search: api.put(`api/domain`)、api.post(`api/domain`)
|
||||||
api[method].apply(api, [`api/domain`, param]).then(() => {
|
api[method].apply(api, [`api/domain`, param]).then(() => {
|
||||||
getDomain();
|
getDomain();
|
||||||
domainStore.loadUserDomains();
|
domainStore.loadUserDomains();
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="q-pa-lg">
|
<div class="q-pa-md">
|
||||||
<div class="q-gutter-sm row items-start">
|
<div class="q-gutter-sm row items-start">
|
||||||
<q-breadcrumbs>
|
<q-breadcrumbs>
|
||||||
<q-breadcrumbs-el icon="assignment_ind" label="ドメイン適用" />
|
<q-breadcrumbs-el icon="assignment_ind" label="ドメイン適用" />
|
||||||
</q-breadcrumbs>
|
</q-breadcrumbs>
|
||||||
</div>
|
</div>
|
||||||
<q-table grid grid-header title="Domain" selection="single" :rows="rows" :columns="columns" row-key="name"
|
<q-table :loading="loading" grid grid-header title="Domain" selection="single" :rows="rows" :columns="columns" row-key="name"
|
||||||
:filter="userDomainTableFilter" virtual-scroll v-model:pagination="pagination">
|
:filter="userDomainTableFilter" virtual-scroll v-model:pagination="pagination">
|
||||||
<template v-slot:top>
|
<template v-slot:top>
|
||||||
|
|
||||||
@@ -131,6 +131,7 @@ import UserList from 'components/UserList.vue';
|
|||||||
const authStore = useAuthStore();
|
const authStore = useAuthStore();
|
||||||
const pagination = ref({ sortBy: 'id', rowsPerPage: 0 });
|
const pagination = ref({ sortBy: 'id', rowsPerPage: 0 });
|
||||||
const rows = ref([] as any[]);
|
const rows = ref([] as any[]);
|
||||||
|
const loading = ref(true);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ name: 'id' },
|
{ name: 'id' },
|
||||||
@@ -219,13 +220,15 @@ const switchUserFinished = async (val: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getDomain = async (userId? : string) => {
|
const getDomain = async (userId? : string) => {
|
||||||
|
loading.value = true;
|
||||||
const resp = await api.get(`api/activedomain${useOtherUser.value ? `?userId=${otherUserId.value}` : ''}`);
|
const resp = await api.get(`api/activedomain${useOtherUser.value ? `?userId=${otherUserId.value}` : ''}`);
|
||||||
activeDomainId.value = resp?.data?.id;
|
activeDomainId.value = resp?.data?.data?.id;
|
||||||
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
|
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
|
||||||
const domains = domainResult.data as any[];
|
const domains = domainResult.data as any[];
|
||||||
rows.value = domains.map((item) => {
|
rows.value = domains.map((item) => {
|
||||||
return { id: item.id, name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd }
|
return { id: item.id, name: item.name, url: item.url, kintoneuser: item.kintoneuser, kintonepwd: item.kintonepwd }
|
||||||
});
|
});
|
||||||
|
loading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|||||||
@@ -66,24 +66,13 @@ export const useAuthStore = defineStore('auth', {
|
|||||||
},
|
},
|
||||||
async getCurrentDomain(): Promise<IDomainInfo> {
|
async getCurrentDomain(): Promise<IDomainInfo> {
|
||||||
const resp = await api.get(`api/activedomain`);
|
const resp = await api.get(`api/activedomain`);
|
||||||
const activedomain = resp?.data;
|
const activedomain = resp?.data?.data;
|
||||||
return {
|
return {
|
||||||
id: activedomain?.id,
|
id: activedomain?.id,
|
||||||
domainName: activedomain?.name,
|
domainName: activedomain?.name,
|
||||||
kintoneUrl: activedomain?.url,
|
kintoneUrl: activedomain?.url,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
async getUserDomains(): Promise<IDomainInfo[]> {
|
|
||||||
const resp = await api.get(`api/domain`);
|
|
||||||
const domains = resp.data as any[];
|
|
||||||
return domains
|
|
||||||
.filter(data => data.is_active)
|
|
||||||
.map((data) => ({
|
|
||||||
id: data.id,
|
|
||||||
domainName: data.name,
|
|
||||||
kintoneUrl: data.url,
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
async getUserInfo():Promise<UserInfo>{
|
async getUserInfo():Promise<UserInfo>{
|
||||||
const resp = (await api.get(`api/v1/users/me`)).data;
|
const resp = (await api.get(`api/v1/users/me`)).data;
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user