Skip to content

Commit

Permalink
fix: logout failed (#24)
Browse files Browse the repository at this point in the history
* fix: logout failed

* build: remove warning info
  • Loading branch information
Serein207 authored Aug 1, 2024
1 parent 1705c99 commit 353620c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ endif()

find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Multimedia)

add_subdirectory(libs/FluentUI)
add_subdirectory(libs/mbedtls)

qt_standard_project_setup(REQUIRES 6.5)

set(CMAKE_AUTORCC ON)
Expand All @@ -27,8 +30,6 @@ set(FLUENTUI_BUILD_EXAMPLES OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND LINUX)
set(FLUENTUI_QML_PLUGIN_DIRECTORY /usr/lib/qt6/qml/FluentUI)
endif()
add_subdirectory(libs/FluentUI)
add_subdirectory(libs/mbedtls)

file(GLOB_RECURSE SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/*.cpp
Expand Down
1 change: 0 additions & 1 deletion src/ViewModel/LoginViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ void LoginViewModel::logout() {
emit logoutFailed(result.unwrapErr().message);
return;
}
auto entity = result.unwrap();
emit logoutSuccess();
});
}
Expand Down
7 changes: 6 additions & 1 deletion src/ViewModel/UserProfileViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ UserProfileViewModel* UserProfileViewModel::create(QQmlEngine*, QJSEngine*) {
}

void UserProfileViewModel::loadUserProfile() {
if (!getIsLogin()) { // when logout
setUserProfileModel(UserProfile());
emit loadUserProfileSuccess();
return;
}
CloudMusicClient::getInstance()->getLoginStatus([=](Result<LoginStatusEntity> result) {
if (result.isErr()) {
emit loadUserProfileFailed(result.unwrapErr().message);
Expand Down Expand Up @@ -59,7 +64,7 @@ bool UserProfileViewModel::getDefaultAvatar() const {
return userProfileModel.defaultAvatar;
}

void UserProfileViewModel::setUserProfileModel(const UserProfile& model) {
void UserProfileViewModel::setUserProfileModel(UserProfile model) {
userProfileModel = std::move(model);
emit userIdChanged();
emit nicknameChanged();
Expand Down
2 changes: 1 addition & 1 deletion src/ViewModel/UserProfileViewModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class UserProfileViewModel : public QObject {

bool getDefaultAvatar() const;

void setUserProfileModel(const UserProfile& model);
void setUserProfileModel(UserProfile model);

signals:
void isLoginChanged();
Expand Down

0 comments on commit 353620c

Please sign in to comment.