Merge pull request #6653 from G-Chubinidze/gc_SCI_9665

Fix setting of ASSET_SYNC_URL on the fronted [SCI-9665]
This commit is contained in:
Martin Artnik 2023-11-16 13:04:29 +01:00 committed by GitHub
commit 6feb61d45c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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'