Skip to content

Commit

Permalink
fixing tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuevIO committed Jan 24, 2025
1 parent 345eab4 commit 7a888c9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
5 changes: 5 additions & 0 deletions src/store/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ export const useAppsStore = defineStore('apps', () => {
appTokens.value = LocalStorage.getObject(LocalStorageItem.AppToken) ?? [];
};

const clearTokensFromStorage = () => {
LocalStorage.delete(LocalStorageItem.AppToken);
};

return {
categories,
appTokens,

addAppToken,
checkAppToken,
getTokensFromStorage,
clearTokensFromStorage,
};
});
6 changes: 2 additions & 4 deletions src/views/apps/ApplicationFrame.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const toolbar = useToolbar();
const router = useRouter();
const profileStore = useProfileStore();
const appStore = useAppsStore();
appStore.getTokensFromStorage();
enum AppState {
WaitLoad = 1,
Expand Down Expand Up @@ -156,9 +155,8 @@ const openApp = async (data: ServiceData) => {
};
onMounted(async () => {
if (history.state.token) {
profileStore.updateToken(history.state.token);
delete history.state.token;
if (profileStore.token && !profileStore.id) {
await AuthApi.getMe(['session_scopes', 'user_scopes']);
}
const { data } = await apiClient.GET('/services/service/{button_id}', {
Expand Down
4 changes: 0 additions & 4 deletions src/views/profile/ProfileEditAuthView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ toolbar.setup({
});
onMounted(async () => {
if (history.state.token) {
profileStore.updateToken(history.state.token);
delete history.state.token;
}
AuthApi.getMe(['auth_methods']);
});
Expand Down
5 changes: 0 additions & 5 deletions src/views/profile/ProfileEditView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ const photoURL = ref('');
const userdata = ref<UserdataArray>([]);

onMounted(async () => {
if (history.state.token) {
profileStore.updateToken(history.state.token);
delete history.state.token;
}

const { data: me } = await AuthApi.getMe([
'auth_methods',
'groups',
Expand Down
5 changes: 0 additions & 5 deletions src/views/profile/ProfileView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ const loadUserdata = async () => {
};
onMounted(async () => {
if (history.state.token) {
profileStore.updateToken(history.state.token);
delete history.state.token;
}
loadUserdata();
});
</script>
Expand Down

0 comments on commit 7a888c9

Please sign in to comment.