Move some code

This commit is contained in:
Pierre HUBERT 2020-06-13 17:25:16 +02:00
parent 1cbae38ee5
commit f190572d42
3 changed files with 12 additions and 3 deletions

View File

@ -63,9 +63,7 @@ void APIRequest::onResponse()
// Check if login token was destroyed // Check if login token was destroyed
if(code == 412) { if(code == 412) {
AccountHelper::RemoveLoginToken(); RefreshService::signOutUser();
RefreshService::stopService();
LoginWindow().exec();
return; return;
} }

View File

@ -1,3 +1,5 @@
#include "accounthelper.h"
#include "loginwindow.h"
#include "refreshservice.h" #include "refreshservice.h"
#include <QGuiApplication> #include <QGuiApplication>
@ -25,6 +27,13 @@ void RefreshService::stopService()
svc = nullptr; svc = nullptr;
} }
void RefreshService::signOutUser()
{
AccountHelper::RemoveLoginToken();
RefreshService::stopService();
LoginWindow().exec();
}
void RefreshService::connectedToWebSocket() void RefreshService::connectedToWebSocket()
{ {
mNotifsHelper.getNewNotificationsNumbers(); mNotifsHelper.getNewNotificationsNumbers();

View File

@ -20,6 +20,8 @@ public:
static void startService(); static void startService();
static void stopService(); static void stopService();
static void signOutUser();
private slots: private slots:
void connectedToWebSocket(); void connectedToWebSocket();
void onNewNumberNotifications(NotificationsNumber number); void onNewNumberNotifications(NotificationsNumber number);