Move saveToken() to account/utilities.js

This commit is contained in:
Robbie Antenesse 2019-05-23 12:23:54 -06:00
parent 401779adb1
commit bf30f108fa
4 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,3 @@
import { setCookie } from "../StackOverflow/cookie";
export function request (data = {}, success = () => {}, error = () => {}/* , fail = () => {} */) {
return fetch('./api/', {
method: 'POST', // or 'PUT'
@ -17,7 +15,3 @@ export function request (data = {}, success = () => {}, error = () => {}/* , fai
return success(response.data);
});
}
export function saveToken(token) {
setCookie('token', token, 30);
}

View File

@ -1,4 +1,5 @@
import { request, saveToken } from "./helpers";
import { request } from "./helpers";
import { saveToken } from "./utilities";
import { addMessage } from "../utilities";
import { setupLogoutButton } from "./setupListeners";
import { renderAccountSettings } from "./render";

View File

@ -1,6 +1,7 @@
import { addMessage } from "../utilities";
import { saveDictionary, clearDictionary } from "../dictionaryManagement";
import { request, saveToken } from "./helpers";
import { request } from "./helpers";
import { saveToken } from "./utilities";
import { renderAll } from "../render";
import { sortWords } from "../wordManagement";

View File

@ -0,0 +1,5 @@
import { setCookie } from "../StackOverflow/cookie";
export function saveToken(token) {
setCookie('token', token, 30);
}