@7365admin1/layer-common 4.21.4-staging.342 → 4.21.4-staging.344
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1945,6 +1945,26 @@ const headers = computed(() => {
|
|
|
1945
1945
|
return list;
|
|
1946
1946
|
});
|
|
1947
1947
|
|
|
1948
|
+
/**
|
|
1949
|
+
* Set when the server refused the Resident Transactions list (403
|
|
1950
|
+
* PERMISSION_DENIED) - e.g. the right was unticked after the page loaded.
|
|
1951
|
+
*/
|
|
1952
|
+
const residentTransactionsDenied = ref(false);
|
|
1953
|
+
const showResidentTransactionsTab = computed(
|
|
1954
|
+
() => props.canViewResidentTransactions && !residentTransactionsDenied.value
|
|
1955
|
+
);
|
|
1956
|
+
|
|
1957
|
+
/** A 403 PERMISSION_DENIED from the server, with its own sentence. */
|
|
1958
|
+
function permissionDenied(error: any): string | null {
|
|
1959
|
+
const body = error?.data ?? error?.response?._data;
|
|
1960
|
+
const status = error?.statusCode ?? error?.status ?? error?.response?.status;
|
|
1961
|
+
if (status !== 403 && body?.code !== "PERMISSION_DENIED") return null;
|
|
1962
|
+
return (
|
|
1963
|
+
(typeof body?.message === "string" && body.message) ||
|
|
1964
|
+
"You do not have permission to view resident transactions."
|
|
1965
|
+
);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1948
1968
|
const tabOptions = computed(() => {
|
|
1949
1969
|
const baseTabs = [
|
|
1950
1970
|
{ name: "Registered", value: "registered" },
|
|
@@ -1952,8 +1972,9 @@ const tabOptions = computed(() => {
|
|
|
1952
1972
|
? [{ name: "Unregistered", value: "unregistered" }]
|
|
1953
1973
|
: []),
|
|
1954
1974
|
{ name: "Guests", value: "guests" },
|
|
1955
|
-
// Its own right in the role editor; the server refuses the list without it
|
|
1956
|
-
|
|
1975
|
+
// Its own right in the role editor; the server refuses the list without it
|
|
1976
|
+
// - and once it has, the tab is hidden for the rest of the visit.
|
|
1977
|
+
...(showResidentTransactionsTab.value
|
|
1957
1978
|
? [{ name: "Resident Transactions", value: "resident-transactions" }]
|
|
1958
1979
|
: []),
|
|
1959
1980
|
{ name: "Overnight Parking", value: "overnight-parking" },
|
|
@@ -2332,7 +2353,20 @@ const {
|
|
|
2332
2353
|
// delete params.checkedOut;
|
|
2333
2354
|
// }
|
|
2334
2355
|
|
|
2335
|
-
|
|
2356
|
+
try {
|
|
2357
|
+
return await getVisitors(params);
|
|
2358
|
+
} catch (error: any) {
|
|
2359
|
+
// Refused by the server: say so with its own message, hide the tab and
|
|
2360
|
+
// go back to Registered - no empty "No data available" table.
|
|
2361
|
+
const denied =
|
|
2362
|
+
activeTab.value === "resident-transactions" ? permissionDenied(error) : null;
|
|
2363
|
+
if (!denied) throw error;
|
|
2364
|
+
residentTransactionsDenied.value = true;
|
|
2365
|
+
items.value = [];
|
|
2366
|
+
showMessage(denied, "error");
|
|
2367
|
+
activeTab.value = "registered";
|
|
2368
|
+
return null;
|
|
2369
|
+
}
|
|
2336
2370
|
},
|
|
2337
2371
|
{
|
|
2338
2372
|
watch: [
|
|
@@ -3068,7 +3102,7 @@ const syncVisitorFiltersFromRoute = () => {
|
|
|
3068
3102
|
const requestedTab = (route.query.tab as string) || "registered";
|
|
3069
3103
|
const nextTab =
|
|
3070
3104
|
(!enableUnregisteredTab.value && requestedTab === "unregistered") ||
|
|
3071
|
-
(!
|
|
3105
|
+
(!showResidentTransactionsTab.value && requestedTab === "resident-transactions")
|
|
3072
3106
|
? "registered"
|
|
3073
3107
|
: requestedTab;
|
|
3074
3108
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.21.4-staging.
|
|
5
|
+
"version": "4.21.4-staging.344",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|