musarehmani100's picture
Upload folder using huggingface_hub
3206347 verified
import appConfig from '../../../config/app.js';
const addAuthHeader = ($, requestConfig) => {
const screenName = $.auth.data?.screenName;
if ($.auth.data?.accessToken) {
requestConfig.headers.Authorization = `${$.auth.data.tokenType} ${$.auth.data.accessToken}`;
}
if (screenName) {
requestConfig.headers[
'User-Agent'
] = `web:automatisch:${appConfig.version} (by /u/${screenName})`;
} else {
requestConfig.headers[
'User-Agent'
] = `web:automatisch:${appConfig.version}`;
}
return requestConfig;
};
export default addAuthHeader;