-
+
+
+ Switch Account
+
+
+
+
+
+
diff --git a/components/modal/ModalContainer.vue b/components/modal/ModalContainer.vue
index 954803db..29ccff74 100644
--- a/components/modal/ModalContainer.vue
+++ b/components/modal/ModalContainer.vue
@@ -1,33 +1,10 @@
-
-
-
- Switch Account
-
-
-
-
-
-
-
-
+
+
diff --git a/composables/accounts.ts b/composables/accounts.ts
index 72e2b28e..79cd41a0 100644
--- a/composables/accounts.ts
+++ b/composables/accounts.ts
@@ -26,6 +26,7 @@ export async function loginTo(user: UserLogin) {
if (currentId.value === accounts.value[existing].account?.id)
return null
currentId.value = user.account?.id
+ await reloadPage()
return true
}
@@ -38,5 +39,25 @@ export async function loginTo(user: UserLogin) {
accounts.value.push(user)
currentId.value = me.id
+ await reloadPage()
return true
}
+
+export async function signout() {
+ // TODO: confirm
+ if (!currentUser.value)
+ return
+
+ const index = accounts.value.findIndex(u => u.account?.id === currentUser.value?.account?.id)
+ if (index === -1)
+ return
+
+ accounts.value.splice(index, 1)
+ currentId.value = accounts.value[0]?.account?.id
+ await reloadPage()
+}
+
+export async function reloadPage(path = '/') {
+ await nextTick()
+ location.pathname = path
+}
diff --git a/layouts/default.vue b/layouts/default.vue
index e6d1d6a5..5d862048 100644
--- a/layouts/default.vue
+++ b/layouts/default.vue
@@ -9,7 +9,13 @@
-
+
diff --git a/pages/signin/callback.vue b/pages/signin/callback.vue
index 01062ee8..80663212 100644
--- a/pages/signin/callback.vue
+++ b/pages/signin/callback.vue
@@ -7,9 +7,6 @@ const { query } = useRoute()
onMounted(async () => {
await loginTo(query as any)
- await nextTick()
- await nextTick()
- location.pathname = '/'
})
diff --git a/styles/vars.css b/styles/vars.css
index 320c1012..3261ed23 100644
--- a/styles/vars.css
+++ b/styles/vars.css
@@ -3,10 +3,12 @@
--c-primary-active: #3a7b8c;
--c-border: #88888820;
--c-bg-base: #fff;
+ --c-bg-active: #efefef;
--c-text-base: #222;
}
.dark {
--c-bg-base: #111;
+ --c-bg-active: #222;
--c-text-base: #fff;
}
diff --git a/unocss.config.ts b/unocss.config.ts
index 770ebabf..f346f658 100644
--- a/unocss.config.ts
+++ b/unocss.config.ts
@@ -14,6 +14,7 @@ export default defineConfig({
{
'border-base': 'border-$c-border',
'bg-base': 'bg-$c-bg-base',
+ 'bg-active': 'bg-$c-bg-active',
'text-base': 'text-$c-text-base',
'interact-disabled': 'disabled:opacity-50 disabled:pointer-events-none disabled:saturate-0',
'btn-solid': 'px-4 py-2 rounded text-white bg-$c-primary hover:bg-$c-primary-active interact-disabled',