https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • h

    high-article-21845

    12/11/2022, 11:53 AM
    yes i am sending the token (jwt as session cookie)
  • m

    miniature-lizard-24702

    12/11/2022, 11:54 AM
    right, so on htmx rquest to that endpoint it sends your cookies
  • m

    miniature-lizard-24702

    12/11/2022, 11:54 AM
    so you can return html back
  • h

    high-article-21845

    12/11/2022, 11:54 AM
    yep
  • m

    miniature-lizard-24702

    12/11/2022, 11:54 AM
    or redirect
  • m

    miniature-lizard-24702

    12/11/2022, 11:55 AM
    in go I'd do a
    http.Redirect(writer, code)
  • h

    high-article-21845

    12/11/2022, 11:55 AM
    so branch on the backend and leave out the whole who-am-i and just handle the lack of cookie on the backend and if it is not there send back a redirect to /login
  • m

    miniature-lizard-24702

    12/11/2022, 11:55 AM
    yes
  • h

    high-article-21845

    12/11/2022, 11:55 AM
    i see
  • h

    high-article-21845

    12/11/2022, 11:55 AM
    thanks!
  • h

    high-article-21845

    12/11/2022, 11:55 AM
    now i think i need to figure out how to convert the spa to this mode of operating
  • m

    miniature-lizard-24702

    12/11/2022, 11:56 AM
    you could even send back html instead when there is no cookie
  • m

    miniature-lizard-24702

    12/11/2022, 11:56 AM
    for some overlay
  • h

    high-article-21845

    12/11/2022, 11:56 AM
    yep
  • m

    miniature-lizard-24702

    12/11/2022, 11:56 AM
    but then you'd need to be careful not to create multiple of them
  • m

    miniature-lizard-24702

    12/11/2022, 11:56 AM
    easier to redirect lol
  • h

    high-article-21845

    12/11/2022, 11:57 AM
    so i could still do html from the CDN and have fragments in SSR where the backend endpoint either redirects to /login or gives you the html you need
  • m

    miniature-lizard-24702

    12/11/2022, 11:58 AM
    yea
  • m

    miniature-lizard-24702

    12/11/2022, 11:58 AM
    for the overlay thing you could have it target only #login_overlay in that case, then it won't create more
  • m

    miniature-lizard-24702

    12/11/2022, 11:58 AM
    initially have the overlay with nothing in
  • m

    miniature-lizard-24702

    12/11/2022, 11:59 AM
    and when your overlay is up and you login you could just refresh
  • h

    high-article-21845

    12/11/2022, 11:59 AM
    ok i will check that
  • h

    high-article-21845

    12/11/2022, 12:00 PM
    so lets say i have a for all the pages /login /usefulefeature etc. how do you share that between these different pages when using htmx + CDN? or should I leave out the CDN part at all?
  • h

    high-article-21845

    12/11/2022, 12:00 PM
    (i am not sure if this question makes sense to you)
  • m

    miniature-lizard-24702

    12/11/2022, 12:02 PM
    I'm not sure I understand
  • m

    miniature-lizard-24702

    12/11/2022, 12:03 PM
    isn't including htmx in the head enough?
  • m

    miniature-lizard-24702

    12/11/2022, 12:04 PM
    do you mean for css/additional js for fragments?
  • r

    ripe-action-67367

    12/11/2022, 12:05 PM
    Hi. https://htmx.org/events/#htmx:configRequest
  • h

    high-article-21845

    12/11/2022, 12:06 PM
    imagine you have /login /something /something-else ..... with all the same CSS, images. In the case of the SPA you do this in the "app" and you dont need to worry about it because the separate urls are virtual. on the CDN everything is set to return the only index.html you have
  • h

    high-article-21845

    12/11/2022, 12:07 PM
    now, i think with htmx i need to split the single index.html to multiple ones to match the /{:path}
1...942943944...1146Latest