Move saveToken() to account/utilities.js
This commit is contained in:
parent
401779adb1
commit
bf30f108fa
|
@ -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);
|
||||
}
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import { setCookie } from "../StackOverflow/cookie";
|
||||
|
||||
export function saveToken(token) {
|
||||
setCookie('token', token, 30);
|
||||
}
|
Loading…
Reference in New Issue