From f4a7a6dd02fc2e68bac816aa921c421fa6a015e4 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Tue, 26 Jul 2022 23:18:39 +0530 Subject: [PATCH] fix(gui-v2): pass socket id as query parameter Signed-off-by: Pranav C --- .../components/dlg/AirtableImport.vue | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/nc-gui-v2/components/dlg/AirtableImport.vue b/packages/nc-gui-v2/components/dlg/AirtableImport.vue index b558d1b74d..d4daabc14e 100644 --- a/packages/nc-gui-v2/components/dlg/AirtableImport.vue +++ b/packages/nc-gui-v2/components/dlg/AirtableImport.vue @@ -24,7 +24,7 @@ const { sqlUi, project, loadTables } = useProject() const loading = ref(false) const step = ref(1) const progress = ref[]>([]) -const socket = ref() +let socket:any; const syncSource = ref({ id: '', type: 'Airtable', @@ -140,8 +140,8 @@ async function sync() { baseURL, method: 'POST', headers: { 'xc-auth': $state.token.value as string }, - body: { - id: socket.value.id, + params: { + id: socket.id, }, }) } catch (e: any) { @@ -177,20 +177,20 @@ watch( ) onMounted(async () => { - socket.value = io(new URL(baseURL, window.location.href.split(/[?#]/)[0]).href, { + socket = io(new URL(baseURL, window.location.href.split(/[?#]/)[0]).href, { extraHeaders: { 'xc-auth': $state.token.value as string }, }) - socket.value.on('connect_error', () => { - socket.value.disconnect() - socket.value = null + socket.on('connect_error', () => { + socket.disconnect() + socket = null }) - socket.value.on('connect', function (data: any) { - console.log(socket.value.id) + socket.on('connect', function (data: any) { + console.log(socket.id) console.log('socket connected', data) }) - socket.value.on('progress', async (d: Record) => { + socket.on('progress', async (d: Record) => { progress.value.push(d) if (d.status === 'COMPLETED') { await loadTables() @@ -201,8 +201,8 @@ onMounted(async () => { }) onBeforeUnmount(() => { - if (socket.value) { - socket.value.disconnect() + if (socket) { + socket.disconnect() } })