You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
681 B
Go
33 lines
681 B
Go
package notification
|
|
|
|
import (
|
|
"github.com/0xJacky/Nginx-UI/model"
|
|
"github.com/0xJacky/Nginx-UI/query"
|
|
)
|
|
|
|
func Info(title string, details string) {
|
|
push(model.NotificationInfo, title, details)
|
|
}
|
|
|
|
func Error(title string, details string) {
|
|
push(model.NotificationError, title, details)
|
|
}
|
|
|
|
func Warning(title string, details string) {
|
|
push(model.NotificationWarning, title, details)
|
|
}
|
|
|
|
func Success(title string, details string) {
|
|
push(model.NotificationSuccess, title, details)
|
|
}
|
|
|
|
func push(nType model.NotificationType, title string, details string) {
|
|
n := query.Notification
|
|
|
|
_ = n.Create(&model.Notification{
|
|
Type: nType,
|
|
Title: title,
|
|
Details: details,
|
|
})
|
|
}
|