feat: FRO-2 Implement Login Component (#8)
Reviewed-on: #8 Reviewed-by: lq64 <lq@blackhole.local> Co-authored-by: Janis <janis.e.20@gmx.de> Co-committed-by: Janis <janis.e.20@gmx.de>
This commit is contained in:
19
src/composables/useUserInfo.ts
Normal file
19
src/composables/useUserInfo.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import {ref, type Ref} from 'vue'
|
||||
|
||||
export const useUserInfo = defineStore('userInfo', () => {
|
||||
const username: Ref<string | null> = ref(null);
|
||||
const userId: Ref<number | null> = ref(null);
|
||||
|
||||
function setUserInfo(name: string, id: number) {
|
||||
username.value = name;
|
||||
userId.value = id;
|
||||
}
|
||||
|
||||
function clearUserInfo() {
|
||||
username.value = null;
|
||||
userId.value = null;
|
||||
}
|
||||
|
||||
return { username, userId, setUserInfo, clearUserInfo };
|
||||
});
|
||||
Reference in New Issue
Block a user