mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-12-28 15:45:43 +00:00
fix: application will raise an error when selecting unsplash image in local mode (#4604)
This commit is contained in:
parent
ef4bce25d8
commit
271f781cce
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:appflowy/shared/custom_image_cache_manager.dart';
|
||||
import 'package:appflowy/util/string_extension.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -56,7 +57,12 @@ class FlowyNetworkImage extends StatelessWidget {
|
||||
final header = <String, String>{};
|
||||
final token = userProfilePB?.token;
|
||||
if (token != null) {
|
||||
header['Authorization'] = 'Bearer ${jsonDecode(token)['access_token']}';
|
||||
try {
|
||||
final decodedToken = jsonDecode(token);
|
||||
header['Authorization'] = 'Bearer ${decodedToken['access_token']}';
|
||||
} catch (e) {
|
||||
Log.error('unable to decode token: $e');
|
||||
}
|
||||
}
|
||||
return header;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user