Add logout resolver

Resolves #8
This commit is contained in:
Lakhan Samani
2021-07-15 15:13:00 +05:30
parent 65fb655f66
commit 1d6191cbcb
6 changed files with 491 additions and 234 deletions

View File

@@ -15,3 +15,14 @@ func SetCookie(gc *gin.Context, token string) {
gc.SetCookie(constants.COOKIE_NAME, token, 3600, "/", GetFrontendHost(), secure, httpOnly)
}
func DeleteCookie(gc *gin.Context) {
secure := true
httpOnly := true
if !constants.IS_PROD {
secure = false
}
gc.SetCookie(constants.COOKIE_NAME, "", -1, "/", GetFrontendHost(), secure, httpOnly)
}