2020-01-29 20:20:36 +00:00
|
|
|
export const formatAttachmentUrl = (attachmentUrl, userId, token, server) => {
|
|
|
|
if (attachmentUrl.startsWith('http')) {
|
|
|
|
if (attachmentUrl.includes('rc_token')) {
|
|
|
|
return encodeURI(attachmentUrl);
|
|
|
|
}
|
|
|
|
return encodeURI(`${ attachmentUrl }?rc_uid=${ userId }&rc_token=${ token }`);
|
|
|
|
}
|
|
|
|
return encodeURI(`${ server }${ attachmentUrl }?rc_uid=${ userId }&rc_token=${ token }`);
|
|
|
|
};
|