Fix setting of ASSET_SYNC_URL on the fronted [SCI-9665]

This commit is contained in:
Giga Chubinidze 2023-11-16 12:28:31 +04:00
parent fd159f0adc
commit 85709d7b43
3 changed files with 7 additions and 1 deletions

View file

@ -38,6 +38,10 @@ class AssetSyncController < ApplicationController
render json: AssetSyncTokenSerializer.new(@asset_sync_token).as_json
end
def api_url
render plain: Constants::ASSET_SYNC_URL
end
# private
def conflicting_asset_copy_token

View file

@ -142,7 +142,8 @@
try {
const response = await axios.get(this.attachment.attributes.urls.open_locally);
const data = response.data;
const syncUrl = GLOBAL_CONSTANTS.ASSET_SYNC_URL;
const syncUrlResponse = await axios.get('/asset_sync_api_url');
const syncUrl = syncUrlResponse.data;
await axios.post(syncUrl, data);
} catch (error) {
console.error("Error in request:", error);

View file

@ -1005,6 +1005,7 @@ Rails.application.routes.draw do
get 'asset_sync/:asset_id', to: 'asset_sync#show', as: :asset_sync_show
get 'asset_sync/:asset_id/download', to: 'asset_sync#download', as: :asset_sync_download
put 'asset_sync', to: 'asset_sync#update'
get '/asset_sync_api_url', to: 'asset_sync#api_url'
post 'global_activities', to: 'global_activities#index'