Bug fix: alias broken auth when switch instance; replace alias to func

This commit is contained in:
localhost_frssoft 2022-04-14 02:51:46 +03:00
parent 4a40baf76a
commit 82630e20c0

View file

@ -20,9 +20,12 @@ echo "Instance: $instance"
if [ -n "$auth" ]; then if [ -n "$auth" ]; then
default_curl_opt() default_curl_opt()
{ {
curl -s --compressed -H "Authorization: Bearer $auth" $1 curl -s --compressed -H "Authorization: Bearer $auth" "$@"
}
post_request()
{
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
} }
alias post_request="curl -s --compressed -X POST -H \"Authorization: Bearer $auth\""
echo '+Authorized account+' echo '+Authorized account+'
else else
default_curl_opt() default_curl_opt()
@ -557,9 +560,12 @@ case $main_menu in
if [ -n "$auth" ]; then if [ -n "$auth" ]; then
default_curl_opt() default_curl_opt()
{ {
curl -s --compressed -H "Authorization: Bearer $auth" $1 curl -s --compressed -H "Authorization: Bearer $auth" "$@"
}
post_request()
{
curl -s --compressed -X POST -H "Authorization: Bearer $auth" "$@"
} }
alias post_request="curl -s --compressed -X POST -H \"Authorization: Bearer $auth\""
echo '+Authorized account+' echo '+Authorized account+'
else else
default_curl_opt() default_curl_opt()