Skip to content

Commit a9da1d6

Browse files
luizhf42otavio
authored andcommitted
refactor(ui): simplify status handling and improve authorization check
1 parent 52427b8 commit a9da1d6

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

ui/src/components/Setting/SettingSessionRecording.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,26 +46,23 @@ const updateSessionRecordingStatus = async (value: boolean) => {
4646
const sessionRecordingStatus = computed({
4747
get: () => store.getters["sessionRecording/isEnabled"],
4848
set: async (value: boolean) => {
49-
updateSessionRecordingStatus(value);
49+
await updateSessionRecordingStatus(value);
5050
},
5151
});
5252
5353
const hasAuthorization = computed(() => {
5454
const role = store.getters["auth/role"];
55-
if (role !== "") {
56-
return hasPermission(
57-
authorizer.role[role],
58-
actions.namespace.enableSessionRecord,
59-
);
60-
}
61-
return false;
55+
if (role === "") return false;
56+
57+
return hasPermission(
58+
authorizer.role[role],
59+
actions.namespace.enableSessionRecord,
60+
);
6261
});
6362
6463
onMounted(async () => {
6564
try {
66-
if (props.hasTenant) {
67-
await store.dispatch("sessionRecording/getStatus");
68-
}
65+
if (props.hasTenant) await store.dispatch("sessionRecording/getStatus");
6966
} catch (error: unknown) {
7067
store.dispatch("snackbar/showSnackbarErrorDefault");
7168
handleError(error);

0 commit comments

Comments
 (0)