sdy

create new middleware

......@@ -16,6 +16,13 @@ export const getUserId = (context) => {
throw new Error("There is no vaild user");
};
export const isAuthenticated = (request) => {
if (!request.user) {
throw new Error("You need to login First");
}
return;
};
export const generateSecret = () => {
const randomNumber = Math.floor(Math.random() * adjectives.length);
return `${adjectives[randomNumber]} ${nouns[randomNumber]}`;
......