rogueserver/api/account/logout.go

26 lines
474 B
Go
Raw Normal View History

2024-04-29 12:32:58 -07:00
// Copyright (C) 2024 Pagefault Games - All Rights Reserved
// https://github.com/pagefaultgames
package account
import (
"database/sql"
"fmt"
2024-04-29 12:22:27 -07:00
"github.com/pagefaultgames/rogueserver/db"
)
// /account/logout - log out of account
func Logout(token []byte) error {
err := db.RemoveSessionFromToken(token)
if err != nil {
if err == sql.ErrNoRows {
return fmt.Errorf("token not found")
}
return fmt.Errorf("failed to remove account session")
}
return nil
}