Fix: https url

This commit is contained in:
2024-06-14 01:37:42 +03:00
parent 27da063c34
commit f5e1407281
4 changed files with 7 additions and 9 deletions

View File

@@ -12,8 +12,7 @@ void main() {
} }
Future<String> getToken(String token, String clientId) async { Future<String> getToken(String token, String clientId) async {
debugPrint(token); var url = Uri.https('gymlink.freemyip.com', 'api/auth/authorize_client');
var url = Uri.http('gymlink.freemyip.com:8080', 'api/auth/authorize_client');
try { try {
var response = await http.post(url, var response = await http.post(url,
body: {'GymKey': token, 'id': clientId}); // Just testing token body: {'GymKey': token, 'id': clientId}); // Just testing token

View File

@@ -53,7 +53,7 @@ class _DetailPageState extends State<DetailPage> {
Future<void> _getItem() async { Future<void> _getItem() async {
final Uri url = final Uri url =
Uri.http('gymlink.freemyip.com:8080', 'api/product/get/${widget.id}'); Uri.https('gymlink.freemyip.com', 'api/product/get/${widget.id}');
final response = await http.get(url, headers: { final response = await http.get(url, headers: {
'Authorization': 'Bearer ${context.read<GymLinkProvider>().token}', 'Authorization': 'Bearer ${context.read<GymLinkProvider>().token}',
}); });

View File

@@ -10,8 +10,7 @@ Future<List<GymItem>> getItems(BuildContext context,
{String searchText = '', String categoryId = ''}) async { {String searchText = '', String categoryId = ''}) async {
final token = context.read<GymLinkProvider>().token; final token = context.read<GymLinkProvider>().token;
if (token != '') { if (token != '') {
final Uri url = final Uri url = Uri.https('gymlink.freemyip.com', 'api/product/get-list');
Uri.http('gymlink.freemyip.com:8080', 'api/product/get-list');
try { try {
final response = await http.post(url, final response = await http.post(url,
headers: { headers: {
@@ -48,7 +47,7 @@ Future<List<GymItem>> getItemsByIds(
return []; return [];
} }
final Uri url = final Uri url =
Uri.http('gymlink.freemyip.com:8080', 'api/product/get-products'); Uri.https('gymlink.freemyip.com', 'api/product/get-products');
try { try {
final response = await http.post(url, final response = await http.post(url,
headers: { headers: {
@@ -76,8 +75,8 @@ Future<List<GymItem>> getItemsByIds(
Future<List<GymCategory>> getCategories(BuildContext context) async { Future<List<GymCategory>> getCategories(BuildContext context) async {
final token = context.read<GymLinkProvider>().token; final token = context.read<GymLinkProvider>().token;
if (token != '') { if (token != '') {
final Uri url = Uri.http( final Uri url = Uri.https(
'gymlink.freemyip.com:8080', 'api/category/get-internal-categories'); 'gymlink.freemyip.com', 'api/category/get-internal-categories');
try { try {
final response = await http.get(url, headers: { final response = await http.get(url, headers: {
'Authorization': 'Bearer $token', 'Authorization': 'Bearer $token',

View File

@@ -8,7 +8,7 @@
let appState = window._appState; let appState = window._appState;
function getToken(token) { function getToken(token) {
fetch('http://gymlink.freemyip.com:8080/api/auth/authorize_client', { fetch('https://gymlink.freemyip.com/api/auth/authorize_client', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ body: JSON.stringify({