#account systeme

6 messages · Page 1 of 1 (latest)

naive hamlet
#

Heyy! i need to create a login/register systeme in my nextjs project, i allready make some api test ect, but i got some truble about how i need to call my api, as exemple when someone register do i need to use a body in my api to put the info to the api or du i use a slug api url?
If someone can help me please, Thanks!

normal umbraBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

naive hamlet
#

what is the best method and how to do it securely?
I haven't used api for a long time and I don't understand it all.

ionic patio
#

The test api you have created, what does it look like?

naive hamlet
#

I create one using the slug api named [id].js and i want to know if that better to use the api req.body (when i try use req.body thats dont work) and my slug api test is :

import { NextApiRequest, NextApiResponse } from 'next'
import User from '../../../module/sequelize/model/User'
import { Sequelize } from 'sequelize'

export default async function handler(_req, res) {
    const { id } = _req.query
    try {

        await User.findOne({
        where: {
            [Sequelize.Op.or]: [{ id: `${id}` }],
        },
        }).then(x=>{
            if(x&&x.username){
                res.end(`${x.username}`)
            }else{
                res.end(`can't find`)
            }
        })

    } catch (error) {
        // Handle any errors that occur during the request
        res.end(`err : ${error}`)
    }
  
}


#

@ionic patio