Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: logout failed #24

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading