(login) notify when token is saved.

This commit is contained in:
2021-04-04 16:45:43 +02:00
parent 913e046135
commit 1191fdbf9b
4 changed files with 23 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ import { computed, ref } from 'vue'
import { DataType } from '@/data/DataType.enum' import { DataType } from '@/data/DataType.enum'
import { GithubAccessToken } from '@/data/models/GithubAccessToken' import { GithubAccessToken } from '@/data/models/GithubAccessToken'
import { data } from '@/data/data' import { data } from '@/data/data'
import { confirmMessage } from '@/utils/notif'
const personalAccessTokenId = 'PAT' const personalAccessTokenId = 'PAT'
const username = ref<string | null>(null) const username = ref<string | null>(null)
@@ -40,6 +41,7 @@ export const useGitHubLogin = () => {
await data.add(personalAccessToken) await data.add(personalAccessToken)
getAccessToken() getAccessToken()
confirmMessage('token saved!')
} }
return { return {

View File

@@ -1,4 +1,5 @@
import '@/registerServiceWorker' import '@/registerServiceWorker'
import 'notyf/notyf.min.css'
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import App from './App.vue' import App from './App.vue'

View File

@@ -73,3 +73,7 @@ a {
} }
} }
} }
.notif-success {
background-color: $link;
}

16
src/utils/notif.ts Normal file
View File

@@ -0,0 +1,16 @@
import { Notyf } from 'notyf'
const notif = new Notyf({
types: [
{
className: 'notif-success',
type: 'confirm'
}
]
})
export const confirmMessage = (message: string) =>
notif.open({
type: 'confirm',
message
})