Updates
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { APILoginFunctionReturn } from "../../package-shared/types";
|
||||
|
||||
/**
|
||||
* Client Setup After Login
|
||||
* ===============================================================================
|
||||
* @description This function sets local storage variables like `csrf` after a user
|
||||
* is logged in. Use this in conjunction with the `datasquirel.user.loginUser`
|
||||
* function
|
||||
*/
|
||||
export default function postLogin(res: APILoginFunctionReturn): boolean {
|
||||
try {
|
||||
if (!res.payload) return false;
|
||||
if (!res.payload.csrf_k) return false;
|
||||
localStorage.setItem("csrf", res.payload.csrf_k);
|
||||
localStorage.setItem("user", JSON.stringify(res.payload));
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+3
-8
@@ -11,14 +11,8 @@ import serializeCookies from "../package-shared/utils/serialize-cookies";
|
||||
import EJSON from "../package-shared/utils/ejson";
|
||||
import numberfy from "../package-shared/utils/numberfy";
|
||||
import slugify from "../package-shared/utils/slugify";
|
||||
import postLogin from "./auth/post-login";
|
||||
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Media Functions Object
|
||||
*/
|
||||
const media = {
|
||||
imageInputToBase64: imageInputToBase64,
|
||||
imageInputFileToBase64: imageInputFileToBase64,
|
||||
@@ -35,7 +29,8 @@ const auth = {
|
||||
github: {
|
||||
getAccessToken: getGithubAccessToken,
|
||||
},
|
||||
logout: logout,
|
||||
logout,
|
||||
postLogin,
|
||||
};
|
||||
|
||||
const utils = {
|
||||
|
||||
Reference in New Issue
Block a user