mirror of
https://github.com/ash-project/ash_admin.git
synced 2024-09-19 21:03:52 +12:00
fix: properly persist cookies
This commit is contained in:
parent
47f87550fe
commit
667fe6ba8c
12 changed files with 63 additions and 8203 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -10,6 +10,8 @@
|
|||
# Where third-party dependencies like ExDoc output generated docs.
|
||||
/doc/
|
||||
|
||||
node_modules
|
||||
|
||||
# Ignore .fetch files in case you like to edit your project deps locally.
|
||||
/.fetch
|
||||
|
||||
|
|
|
@ -128,6 +128,15 @@ Hooks.Actor = {
|
|||
this.handleEvent("toggle_actor_paused", (payload) => {
|
||||
document.cookie = "actor_paused" + "=" + payload.actor_paused + ";path=/";
|
||||
});
|
||||
|
||||
this.pushEvent("set_actor_from_session", {
|
||||
actor_resource: document.cookie.actor_resource,
|
||||
actor_primary_key: document.cookie.actor_primary_key,
|
||||
actor_action: document.cookie.actor_action,
|
||||
actor_api: document.cookie.actor_api,
|
||||
actor_authorizing: document.cookie.actor_authorizing,
|
||||
actor_paused: document.cookie.actor_paused
|
||||
})
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -306,6 +306,19 @@ defmodule AshAdmin.PageLive do
|
|||
|> push_event("clear_actor", %{})}
|
||||
end
|
||||
|
||||
def handle_event("set_actor_from_session", payload, socket) do
|
||||
assigns =
|
||||
payload
|
||||
|> Map.take(
|
||||
~w[actor_resource actor_primary_key actor_action actor_api actor_authorizing actor_paused]
|
||||
)
|
||||
|> Enum.map(fn {key, value} ->
|
||||
{String.to_existing_atom(key), value}
|
||||
end)
|
||||
|
||||
{:noreply, assign(socket, assigns)}
|
||||
end
|
||||
|
||||
def handle_event(
|
||||
"set_actor",
|
||||
%{"resource" => resource, "api" => api, "pkey" => primary_key},
|
||||
|
|
File diff suppressed because one or more lines are too long
BIN
priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css.gz
Normal file
BIN
priv/static/assets/app-161d914bba3ef8912bae46d62332075a.css.gz
Normal file
Binary file not shown.
23
priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js
Normal file
23
priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js
Normal file
File diff suppressed because one or more lines are too long
BIN
priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js.gz
Normal file
BIN
priv/static/assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js.gz
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
priv/static/assets/app.css.gz
Normal file
BIN
priv/static/assets/app.css.gz
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
BIN
priv/static/assets/app.js.gz
Normal file
BIN
priv/static/assets/app.js.gz
Normal file
Binary file not shown.
6
priv/static/cache_manifest.json
Normal file
6
priv/static/cache_manifest.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"!comment!":"This file was auto-generated by `mix phx.digest`. Remove it and all generated artefacts with `mix phx.digest.clean --all`",
|
||||
"version":1,
|
||||
"latest":{"assets/app.css":"assets/app-161d914bba3ef8912bae46d62332075a.css","assets/app.js":"assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js"},
|
||||
"digests":{"assets/app-161d914bba3ef8912bae46d62332075a.css":{"size":35588,"sha512":"UD0fP1n3WDpLGBt/Z/B2CpSpg8DUFlcIM3LV86qlBW28sgXzM2nOogI6tFmH6IclRlq2VBl+O5Pc+TKkBgHTcg==","digest":"161d914bba3ef8912bae46d62332075a","logical_path":"assets/app.css","mtime":63858229399},"assets/app-c9fc8078e7bd6db471c3dfa3fcebe839.js":{"size":92526,"sha512":"GzSgXYTWePK9QG0akmOU5Xv0o+H0UvSGvNo3jKMKI8m/iPH/+S7Of2p1q/bvc722pqyZB8rHCBv3hFNCZtrMcQ==","digest":"c9fc8078e7bd6db471c3dfa3fcebe839","logical_path":"assets/app.js","mtime":63858229399}}
|
||||
}
|
Loading…
Reference in a new issue