Skip to content

Commit

Permalink
Bugfix: Fix token types (#35)
Browse files Browse the repository at this point in the history
* added LocalStorage and adapted profileStore

* simultaneous check for token and scopes

* fix token check and clear up currId type conversion

* fox scopes type consistency

* fixed token types not matching with api-uilib
  • Loading branch information
BatuevIO authored Nov 24, 2024
1 parent 77065b9 commit 3e86b96
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const profileStore = useProfileStore();
onMounted(() => {
profileStore.fromUrl();
console.log(document.location.toString());
console.log(profileStore.token);
setupAuth(profileStore.token);
});
</script>
Expand Down
6 changes: 3 additions & 3 deletions src/store/profileStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LocalStorage, LocalStorageItem } from '../models/LocalStorage';
export const useProfileStore = defineStore('profile', () => {
const id = ref<number | null>(null);
const email = ref<string | null>(null);
const token = ref<string | null>();
const token = ref<string | undefined>(undefined);
const groups = ref<number[] | null>(null);
const indirectGroups = ref<number[] | null>(null);
const userScopes = ref<string[] | null>(null);
Expand All @@ -22,10 +22,10 @@ export const useProfileStore = defineStore('profile', () => {
const urlScopes = url.searchParams.get('scopes')?.split(',');

if (urlToken === null && urlScopes === undefined) {
token.value = localToken;
token.value = localToken === null ? undefined : localToken;
sessionScopes.value = localScopes;
} else {
token.value = urlToken;
token.value = urlToken === null ? undefined : urlToken;
sessionScopes.value = urlScopes || [];
LocalStorage.set(LocalStorageItem.Token, urlToken);
LocalStorage.set(LocalStorageItem.TokenScopes, urlScopes);
Expand Down

0 comments on commit 3e86b96

Please sign in to comment.