[UI] dialog and redirect for no active domain
This commit is contained in:
@@ -123,12 +123,14 @@
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { api } from 'boot/axios';
|
||||
import { useAuthStore } from 'stores/useAuthStore';
|
||||
import { useDomainStore } from 'stores/useDomainStore';
|
||||
|
||||
import ShowDialog from 'components/ShowDialog.vue';
|
||||
import DomainSelect from 'components/DomainSelect.vue';
|
||||
import UserList from 'components/UserList.vue';
|
||||
|
||||
const authStore = useAuthStore();
|
||||
const domainStore = useDomainStore();
|
||||
const pagination = ref({ sortBy: 'id', rowsPerPage: 0 });
|
||||
const rows = ref([] as any[]);
|
||||
const rowIds = new Set<string>();
|
||||
@@ -166,7 +168,18 @@ const addUserDomainFinished = (val: string) => {
|
||||
const selected = addDomainRef.value.selected;
|
||||
if (val == 'OK' && selected.length > 0) {
|
||||
api.post(`api/domain/${useOtherUser.value ? otherUserId.value : authStore.userId}?domainid=${selected[0].id}`)
|
||||
.then(() => { getDomain(useOtherUser.value ? otherUserId.value : undefined); });
|
||||
.then(({ data }) => {
|
||||
if (rows.value.length === 0 && data.data) {
|
||||
const domain = data.data;
|
||||
authStore.setCurrentDomain({
|
||||
id: domain.id,
|
||||
kintoneUrl: domain.url,
|
||||
domainName: domain.name
|
||||
});
|
||||
}
|
||||
domainStore.loadUserDomains();
|
||||
getDomain(useOtherUser.value ? otherUserId.value : undefined);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -223,7 +236,11 @@ const switchUserFinished = async (val: string) => {
|
||||
const getDomain = async (userId? : string) => {
|
||||
loading.value = true;
|
||||
rowIds.clear();
|
||||
const resp = await api.get(`api/activedomain${useOtherUser.value ? `?userId=${otherUserId.value}` : ''}`);
|
||||
if (useOtherUser.value) {
|
||||
// TODO
|
||||
return;
|
||||
}
|
||||
const resp = await api.get(`api/activedomain`);
|
||||
activeDomainId.value = resp?.data?.data?.id;
|
||||
const domainResult = userId ? await api.get(`api/domain?userId=${userId}`) : await api.get(`api/domain`);
|
||||
const domains = domainResult.data as any[];
|
||||
|
||||
Reference in New Issue
Block a user