Bläddra i källkod

fix: connections not updated in the Conditions block

Ahmad Kholid 2 år sedan
förälder
incheckning
10c9c998dd
2 ändrade filer med 7 tillägg och 8 borttagningar
  1. 5 6
      src/components/newtab/workflow/edit/EditConditions.vue
  2. 2 2
      src/utils/api.js

+ 5 - 6
src/components/newtab/workflow/edit/EditConditions.vue

@@ -124,7 +124,7 @@ import { ref, watch, onMounted, shallowReactive } from 'vue';
 import { useI18n } from 'vue-i18n';
 import { nanoid } from 'nanoid';
 import Draggable from 'vuedraggable';
-import { sleep } from '@/utils/helper';
+import { debounce } from '@/utils/helper';
 import SharedConditionBuilder from '@/components/newtab/shared/SharedConditionBuilder/index.vue';
 
 const props = defineProps({
@@ -190,11 +190,10 @@ function deleteCondition(index, id) {
 function updateData(value) {
   emit('update:data', { ...props.data, ...value });
 }
-async function onEnd() {
-  props.editor.addSelectedNodes([]);
-  await sleep(1000);
-  props.editor.addSelectedNodes([props.editor.getNode.value(props.blockId)]);
-}
+
+const onEnd = debounce(() => {
+  props.editor.updateNodeInternals([props.blockId]);
+}, 500);
 
 watch(
   conditions,

+ 2 - 2
src/utils/api.js

@@ -13,9 +13,9 @@ export async function fetchApi(path, options) {
   if (session) {
     let token = session.access_token;
 
-    if (Date.now() > session.expires_at * 1000) {
+    if (Date.now() > (session.expires_at - 2000) * 1000) {
       const response = await fetch(
-        `${secrets.baseApiUrl}/me/refresh-auth-session`
+        `${secrets.baseApiUrl}/me/refresh-auth-session?token=${session.refresh_token}`
       );
       const result = await response.json();
       if (!response.ok) {