How to set cookie with JS hooks? #4564
Answered
by
ganigeorgiev
VictorioBerra
asked this question in
Q&A
-
GoLang: e.HttpContext.SetCookie(&http.Cookie{
Name: cookieName,
Value: e.Token,
Expires: time.Now().Add(time.Second * time.Duration(sets().RecordAuthToken.Duration)),
Path: "/",
SameSite: http.SameSiteStrictMode,
}) How can I do the same with JS?
|
Beta Was this translation helpful? Give feedback.
Answered by
ganigeorgiev
Mar 14, 2024
Replies: 1 comment
-
The JSVM method names are e.httpContext.setCookie(new Cookie({ ... })) If you haven't already, you can reference the builtin ambient TS declarations at the top of your /// <reference path="../pb_data/types.d.ts" /> (For HTML version of the above types you can check https://pocketbase.io/jsvm/index.html) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
VictorioBerra
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The JSVM method names are
camelCased
. You can try with:If you haven't already, you can reference the builtin ambient TS declarations at the top of your
.pb.js
file to assist you autocomplete and documentation on hover:/// <reference path="../pb_data/types.d.ts" />
(For HTML version of the above types you can check https://pocketbase.io/jsvm/index.html)