How to make middleware auth in nuxtjs3?

Hello everyone, can anyone help me again about how we can make the middleware for authentication user & role user in nuxtjs 3.
My Response Data looking like this:
{
    "status": true,
    "message": "Login successful",
    "data": {
        "user": {
            "id": 7,
            "rememberToken": null,
            "fullName": "User Example",
            "email": "user@example.com",
            "phone": null,
            "province": null,
            "city": null,
            "address": null,
            "gender": "l",
            "roleId": 1,
            "experience": null,
            "rating": 0,
            "photo": null,
            "biography": null,
            "status": 1,
            "isVerified": 1,
            "createdAt": "2024-10-30T07:43:48.000+00:00",
            "updatedAt": "2024-10-30T07:43:48.000+00:00"
        },
        "token": {
            "headers": {
                "authorization": "Bearer oat_Mjk.aWo0Z3lxSEFXS0NUaGt5ejFhbVNwU2xhT3pMM3dRYUlXT29mMVFCRzEyMTcxMzI4MzM"
            }
        }
    }
}
Was this page helpful?