public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Muhammad Rizki <[email protected]>
Cc: Ammar Faizi <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>
Subject: [PATCH gwmail 6/7] routes: layout: Adjust field with new API
Date: Fri, 28 Feb 2025 06:22:33 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

A bit breaking change, all user info is now stored at "user_info" field.

Before:
```
{
  "code": 200,
  "res": {
    "id": 2,
    "full_name": "Ammar Faizi",
    "gender": "m",
    "username": "ammarfaizi2",
    "role": "user",
    "is_active": "1",
    "renew_token": {
      "token": "...",
      "token_exp_at": 1741842452
    }
  }
}
```

After:
```
{
  "code": 200,
  "res": {
    "user_info": {
      "id": 2,
      "full_name": "Ammar Faizi",
      "gender": "m",
      "username": "ammarfaizi2",
      "ext_email": "[email protected]",
      "role": "user",
      "is_active": "1",
      "socials": {
        "github_username": "ammarfaizi2",
        "telegram_username": "ammarfaizi2",
        "twitter_username": "ammarfaizi2",
        "discord_username": "ammarfaizi2"
      },
      "photo": null
    },
    "renew_token": {
      "token": "...",
      "token_exp_at": 1741842452
    }
  }
}
```

Signed-off-by: Ammar Faizi <[email protected]>
---
 src/routes/(protected)/+layout.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/routes/(protected)/+layout.ts b/src/routes/(protected)/+layout.ts
index 2d1813a2534e..64019ba23012 100644
--- a/src/routes/(protected)/+layout.ts
+++ b/src/routes/(protected)/+layout.ts
@@ -16,6 +16,6 @@ export const load: LayoutLoad = async () => {
     params: { action: "get_user_info" }
   });
 
-  localStorage.setItem("gwm_uinfo", JSON.stringify(data.res));
+  localStorage.setItem("gwm_uinfo", JSON.stringify(data.res.user_info));
   auth.refresh();
 };
-- 
Ammar Faizi


  parent reply	other threads:[~2025-02-27 23:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-27 23:22 [PATCH gwmail 0/7] User Profile Page Ammar Faizi
2025-02-27 23:22 ` [PATCH gwmail 1/7] settings/account: Add header 'change password' Ammar Faizi
2025-02-27 23:22 ` [PATCH gwmail 2/7] public: Refactor old interface to keep up with new API Ammar Faizi
2025-02-27 23:22 ` [PATCH gwmail 3/7] Rename 'public' to 'old' Ammar Faizi
2025-02-27 23:22 ` [PATCH gwmail 4/7] old: Add profile page Ammar Faizi
2025-02-27 23:22 ` [PATCH gwmail 5/7] old: Add photo profile support Ammar Faizi
2025-02-27 23:22 ` Ammar Faizi [this message]
2025-02-27 23:22 ` [PATCH gwmail 7/7] old: Use relative path to redirect Ammar Faizi
2025-02-27 23:28 ` [PATCH gwmail 0/7] User Profile Page Ammar Faizi
2025-02-27 23:31   ` Ammar Faizi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox