Skip to content

Commit

Permalink
add path for cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
matievisthekat committed Jul 15, 2021
1 parent c4ef31c commit ce926e7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Storage {
this.data = {};
}

set(name, value) {
set(name, value, _) {
this.data[name] = value;
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Updater.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = class Updater {
if (!token) throw new Error("[Updater.setAccessToken] No token provided");
if (typeof token !== "string") throw new TypeError("[Updater.setAccessToken] Token is not a string");

this.storage.set(cookies.accessToken, token);
this.storage.set(cookies.accessToken, token, { path: "/" });
return this;
}

Expand All @@ -55,7 +55,7 @@ module.exports = class Updater {
if (!token) throw new Error("[Updater.setRefreshToken] No token provided");
if (typeof token !== "string") throw new TypeError("[Updater.setRefreshToken] Token is not a string");

this.storage.set(cookies.refreshToken, token);
this.storage.set(cookies.refreshToken, token, { path: "/" });
return this;
}

Expand Down
4 changes: 2 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AxiosPromise, AxiosRequestConfig } from "axios";
import Cookies from "universal-cookie";
import Cookies, { CookieGetOptions, CookieSetOptions } from "universal-cookie";

declare module "spotify-oauth-refresher" {
export default class Updater {
Expand All @@ -22,7 +22,7 @@ declare module "spotify-oauth-refresher" {
constructor();

get<T = any>(name: string): T;
set(name: string, value: any): this;
set(name: string, value: any, opts: CookieSetOptions): this;
}

export interface UpdaterRequestConfig extends AxiosRequestConfig {
Expand Down

0 comments on commit ce926e7

Please sign in to comment.