Skip to content

Commit

Permalink
new api support
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuevIO committed Nov 4, 2024
1 parent cfc292a commit 4cf6130
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 131 deletions.
122 changes: 0 additions & 122 deletions src/api/auth/UserSessionApi.ts

This file was deleted.

18 changes: 9 additions & 9 deletions src/views/apps/ApplicationFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,24 @@ const getToken = async () => {
}
// 3. Если пользователь разрешает – запрашиваем токен на Auth api и возвращаем его
const session = (
await userSessionApi.createSession(scopes.value.length == 0 ? {} : { scopes: scopes.value })
).data;
if (!session) {
const { data } = await apiClient.POST('/auth/session', {
body: { scopes: scopes.value.length == 0 ? [] : scopes.value },
});
if (!data) {
appState.value = AppState.Error;
return;
}
authItem.token = session.token;
authItem.expires = session.expires;
profileStore.id = session.user_id;
authItem.token = data.token;
authItem.expires = data.expires;
profileStore.id = data.user_id;
if (authItemIndex != -1) {
appsData[authItemIndex] = authItem;
} else {
appsData.push(authItem);
}
LocalStorage.set(LocalStorageItem.SuperappAuth, appsData);
return session.token;
return data.token;
};
const openApp = async (data: ServiceData) => {
Expand All @@ -160,7 +160,7 @@ const openApp = async (data: ServiceData) => {
}
// Пользователь не авторизован => Кнопка разблокирована и не требует авторизации => Показываем приложение
if (data.view == ButtonView.Active && !profileStore.id) {
if (data.view == 'active' && !profileStore.id) {
appState.value = AppState.Show;
return;
}
Expand Down

0 comments on commit 4cf6130

Please sign in to comment.